Allow removing users two factors

This commit is contained in:
Daniel García
2019-08-21 17:13:06 +02:00
parent d23d4f2c1d
commit 026f9da035
3 changed files with 27 additions and 6 deletions

View File

@ -95,9 +95,7 @@ fn recover(data: JsonUpcase<RecoverTwoFactor>, conn: DbConn) -> JsonResult {
}
// Remove all twofactors from the user
for twofactor in TwoFactor::find_by_user(&user.uuid, &conn) {
twofactor.delete(&conn)?;
}
TwoFactor::delete_all_by_user(&user.uuid, &conn)?;
// Remove the recovery code, not needed without twofactors
user.totp_recover = None;