added extra confirm verification guards

This commit is contained in:
Gani Georgiev
2026-05-27 09:51:43 +03:00
parent ea2ef87d08
commit 167e23e9ba
2 changed files with 87 additions and 1 deletions
+7
View File
@@ -45,6 +45,13 @@ func recordConfirmVerification(e *core.RequestEvent) error {
if !wasVerified {
e.Record.SetVerified(true)
// similar to the OTP auth, we enforce an extra password reset
// guard as this way is less prone to pre-hijacking attacks
// in case the password auth is eventually enabled later
if !e.Record.Collection().PasswordAuth.Enabled {
e.Record.SetRandomPassword()
}
if err := e.App.Save(e.Record); err != nil {
return firstApiError(err, e.BadRequestError("An error occurred while saving the verified state.", err))
}