Commit f776a1d6 authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Db: Add SetPassword trait to change passwords of users

parent 5ee059a5
...@@ -847,3 +847,18 @@ impl MedalObject<Connection> for Group { ...@@ -847,3 +847,18 @@ impl MedalObject<Connection> for Group {
} }
} }
} }
pub trait SetPassword {
fn set_password(&mut self, &str) -> Option<()>;
}
impl SetPassword for SessionUser {
fn set_password(&mut self, password: &str) -> Option<()> {
let salt = "blub";
let hash = hash_password(password, salt);
self.password = Some(hash);
self.salt = Some(salt.into());
Some(())
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment