reset/update password
This commit is contained in:
@@ -209,6 +209,21 @@ impl UserRepository for SqliteUserRepository {
|
||||
}))
|
||||
}
|
||||
|
||||
async fn update_password_hash(
|
||||
&self,
|
||||
txn: &mut SqliteConnection,
|
||||
user_id: i64,
|
||||
password_hash: String,
|
||||
) -> DomainResult<()> {
|
||||
sqlx::query("UPDATE users SET password_hash = ?1 WHERE id = ?2")
|
||||
.bind(&password_hash)
|
||||
.bind(user_id)
|
||||
.execute(&mut *txn)
|
||||
.await
|
||||
.map_err(db_error)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn has_users(&self, txn: &mut SqliteConnection) -> DomainResult<bool> {
|
||||
let row = sqlx::query("SELECT EXISTS(SELECT 1 FROM users)")
|
||||
.fetch_one(&mut *txn)
|
||||
|
||||
Reference in New Issue
Block a user