cake-order-tracker/auth/credentials.go
2026-06-10 19:38:35 +02:00

19 lines
401 B
Go

package auth
import (
"errors"
"git.bronku.xyz/bronku/cake-order-tracker/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")
}