Fixed delete user when 2FA is enabled, implemented delete user for admin panel, and the front-end part for invite user. Secured admin panel behind a configurable token.

This commit is contained in:
Daniel García
2018-12-18 18:52:58 +01:00
parent 5fecf09631
commit 1b5134dfe2
6 changed files with 154 additions and 71 deletions

View File

@@ -107,4 +107,12 @@ impl TwoFactor {
.filter(twofactor::type_.eq(type_))
.first::<Self>(&**conn).ok()
}
}
pub fn delete_all_by_user(user_uuid: &str, conn: &DbConn) -> QueryResult<usize> {
diesel::delete(
twofactor::table.filter(
twofactor::user_uuid.eq(user_uuid)
)
).execute(&**conn)
}
}