pub async fn record_failed_attempt(
conn: &mut PgConnection,
user_id: Uuid,
purpose: UserEmailCodePurpose,
max_attempts: i32,
) -> ModelResult<()>Expand description
Counts a wrong guess against the user’s live code and retires it once max_attempts is reached.
Keyed on the user and purpose rather than on what was typed: there is only ever one live code, so any refused guess is a guess against it.