feat(identity): confirm registration email atomically
This commit is contained in:
1 parent
8e7ce8d71c
commit
fade4e76e4
75 files changed
+4188
-403
No files matched your search
@@ -37,3 +37,18 @@ func (credentials *Credentials) HashNewPassword(ctx context.Context, raw string)
|
||||
}
|
||||
return hash, nil
|
||||
}
|
||||
|
||||
// VerifyLoginPassword normalizes and checks a password with the login bounds.
|
||||
// It does not apply the registration blocklist, so an existing registration
|
||||
// can confirm even when that password is no longer accepted for new accounts.
|
||||
func (credentials *Credentials) VerifyLoginPassword(ctx context.Context, raw string, stored domain.PasswordHash) error {
|
||||
const location = "Credentials.VerifyLoginPassword"
|
||||
password, err := domain.ParseLoginPassword(raw)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s - validate password: %w", location, err)
|
||||
}
|
||||
if _, err := credentials.hasher.Verify(ctx, password, stored); err != nil {
|
||||
return fmt.Errorf("%s - verify password: %w", location, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user