cake-order-tracker/auth/credentials.go
2025-06-19 21:48:06 +02:00

19 lines
384 B
Go

package auth
import (
"errors"
"github.com/Bronku/iroon/crypto"
)
func (a *Authenticator) verifyCredentials(login, password string) error {
user, ok := a.s.GetUser(login)
if !ok {
return errors.New("user with this login doesn't exist")
}
hash := crypto.PasswordHash(password, user.Salt)
if hash == user.Password {
return nil
}
return errors.New("wrong credentials")
}