fix totp authentication
This commit is contained in:
parent
fffcf5ee8f
commit
cf69255acd
|
@ -76,7 +76,8 @@ pub async fn verify_totp_token(otpid: String, email: String, db: &PgPool) -> Res
|
|||
}
|
||||
|
||||
pub async fn use_totp_token(otpid: String, email: String, db: &PgPool) -> Result<TOTP, Box<dyn Error>> {
|
||||
let totpmachine = verify_totp_token(otpid.clone(), email, db).await?;
|
||||
let totpmachine = verify_totp_token(otpid.clone(), email.clone(), db).await?;
|
||||
sqlx::query!("DELETE FROM totp_create_tokens WHERE id = $1", otpid).execute(db).await?;
|
||||
sqlx::query!("UPDATE users SET totp_otpurl = $1, totp_secret = $2, totp_verified = 1 WHERE email = $3", totpmachine.get_url(), totpmachine.get_secret_base32(), email).execute(db).await?;
|
||||
Ok(totpmachine)
|
||||
}
|
Loading…
Reference in New Issue