Skip to main content

Module user_passwords

Module user_passwords 

Source

Structsยง

PasswordResetToken
UserPassword

Enumsยง

PasswordVerifyResult ๐Ÿ”’
Outcome of verifying a password against a stored Argon2 hash.

Staticsยง

LEGACY_RAW_PASSWORD_FALLBACK_UNTIL ๐Ÿ”’
Passwords whose hash was stored under the pre-normalization (raw byte) form are accepted until this instant; afterwards only the NFC form is checked and any not-yet-converted user must reset their password. Set to one year after the normalization rollout โ€” ADJUST to one year after the actual deploy date.

Functionsยง

change_user_password_with_old_password
change_user_password_with_password_reset_token
check_if_users_password_is_stored
get_unused_reset_password_token_with_user_id
hash_password
insert_password_reset_token
is_reset_password_token_valid
legacy_raw_fallback_active ๐Ÿ”’
Whether the legacy raw-byte password form is still accepted at now.
mark_token_used
normalize_password ๐Ÿ”’
Normalize a password to Unicode NFC before it is hashed or verified.
update_password_hash_if_unchanged ๐Ÿ”’
Re-stores new_hash for the user only if the currently stored hash still equals expected_current_hash (a compare-and-swap). Returns true if the row was updated and false if the stored hash had already changed (e.g. a concurrent password change) or no active row matched, in which case nothing is written. Used by the legacy-rehash path so that a concurrent password change is never clobbered by re-storing a hash derived from the old password.
upsert_user_password
verify_against_hash ๐Ÿ”’
Verify a password against a stored Argon2 hash, tolerant of Unicode normalization.
verify_user_password