Skip to main content

insert_user_email_code

Function insert_user_email_code 

Source
pub async fn insert_user_email_code(
    conn: &mut PgConnection,
    user_id: Uuid,
    purpose: UserEmailCodePurpose,
    code: &DbSecret,
) -> ModelResult<()>
Expand description

Retires the user’s outstanding code for purpose and inserts a new one.

The unique index allows only one live code per user and purpose, so the retirement is what makes a resend possible at all.