Add new subcomand for plm to reset password (#406)

* Add new subcomand for plm to reset password

* Verify user exist before asking for new password
This commit is contained in:
fdb-hiroshima
2019-01-03 16:45:27 +01:00
committed by Igor Galić
parent dfa89e227a
commit 2333d898b9
2 changed files with 35 additions and 1 deletions
+7
View File
@@ -381,6 +381,13 @@ impl User {
.unwrap_or(false)
}
pub fn reset_password(&self, conn: &Connection, pass: &str) -> Result<()> {
diesel::update(self)
.set(users::hashed_password.eq(User::hash_pass(pass)?))
.execute(conn)?;
Ok(())
}
pub fn update_boxes(&self, conn: &Connection) -> Result<()> {
let instance = self.get_instance(conn)?;
if self.outbox_url.is_empty() {