Properly verify password

fix #86
This commit is contained in:
Trinity Pointard 2018-06-25 15:38:39 +02:00
parent 3bc90e71d4
commit 5133410451
1 changed files with 5 additions and 1 deletions

View File

@ -205,7 +205,11 @@ impl User {
}
pub fn auth(&self, pass: String) -> bool {
bcrypt::verify(pass.as_str(), self.hashed_password.clone().unwrap().as_str()).is_ok()
if let Ok(valid) = bcrypt::verify(pass.as_str(), self.hashed_password.clone().unwrap().as_str()) {
valid
} else {
false
}
}
pub fn update_boxes(&self, conn: &PgConnection) {