✨ Check password
This commit is contained in:
parent
072031f86c
commit
c67e970b2f
4 changed files with 24 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ package config
|
|||
import (
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/kirsle/configdir"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
|
|
@ -79,3 +80,9 @@ func init() {
|
|||
func GetConfig() Config {
|
||||
return config
|
||||
}
|
||||
|
||||
func CheckPassword(pass string) bool {
|
||||
err := bcrypt.CompareHashAndPassword([]byte(config.Password), []byte(pass))
|
||||
|
||||
return err == nil
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue