Check password

This commit is contained in:
Dan Jones 2023-03-23 21:20:44 -05:00
commit c67e970b2f
4 changed files with 24 additions and 2 deletions

View file

@ -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
}