working commit

This commit is contained in:
2026-02-12 17:52:05 +02:00
parent fbbb09a3cb
commit c2d231c844
6 changed files with 63 additions and 50 deletions
-19
View File
@@ -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"`