From 513341045145822fb2725fe061c7c693d030cd4c Mon Sep 17 00:00:00 2001 From: Trinity Pointard Date: Mon, 25 Jun 2018 15:38:39 +0200 Subject: [PATCH] Properly verify password fix #86 --- plume-models/src/users.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 7f36732..6a107c5 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -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) {