Skip to main content

Module user_email_codes

Module user_email_codes 

Source

Structs§

UserEmailCode

Enums§

UserEmailCodePurpose
What a code authorises. Every read is scoped by it, so a code mailed for one action cannot be spent on another.

Functions§

generate_code
A fresh code for mailing to a user.
get_unused_user_email_code_with_user_id
insert_user_email_code
Retires the user’s outstanding code for purpose and inserts a new one.
is_reset_user_email_code_valid
mark_user_email_code_used
record_failed_attempt
Counts a wrong guess against the user’s live code and retires it once max_attempts is reached.