Implement constant time equal check for admin, 2fa recover and 2fa remember tokens

This commit is contained in:
Daniel García
2019-02-11 23:45:55 +01:00
parent bbe2a1b264
commit 9636f33fdb
4 changed files with 13 additions and 3 deletions

View File

@@ -86,7 +86,7 @@ impl User {
pub fn check_valid_recovery_code(&self, recovery_code: &str) -> bool {
if let Some(ref totp_recover) = self.totp_recover {
recovery_code == totp_recover.to_lowercase()
crate::crypto::ct_eq(recovery_code, totp_recover.to_lowercase())
} else {
false
}