working commit
This commit is contained in:
@@ -10,25 +10,6 @@ import (
|
||||
"mstore/pkg/auxuuid"
|
||||
)
|
||||
|
||||
func (oper *Operator) ValidatePassword(ctx context.Context, username, password string) (bool, string, error) {
|
||||
var err error
|
||||
var accountID string
|
||||
valid := false
|
||||
|
||||
accountExists, accountDescr, err := oper.mdb.GetAccountByUsername(ctx, username)
|
||||
if !accountExists {
|
||||
err := fmt.Errorf("Account not exists")
|
||||
return valid, accountID, err
|
||||
}
|
||||
if !auxpwd.PasswordMatch([]byte(password), accountDescr.Passhash) {
|
||||
err := fmt.Errorf("Login data mismatch")
|
||||
return valid, accountID, err
|
||||
}
|
||||
valid = true
|
||||
accountID = accountDescr.ID
|
||||
return valid, accountID, err
|
||||
}
|
||||
|
||||
type CreateAccountParams struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
|
||||
Reference in New Issue
Block a user