summaryrefslogtreecommitdiffstats
path: root/atuin-server-postgres
diff options
context:
space:
mode:
authorTymanWasTaken <ty@blahaj.land>2024-01-29 06:17:10 -0500
committerGitHub <noreply@github.com>2024-01-29 11:17:10 +0000
commit0faf414cd958137ac60a1f37288994f3a1441780 (patch)
treedf7199c0366893dc393d1cc53230a8f39e88d036 /atuin-server-postgres
parente1c2b9c783587547cbf740ee76206507fbbde330 (diff)
feat: Add change-password command & support on server (#1615)
* Add change-password command & support on server * Add a test for password change * review: run format --------- Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
Diffstat (limited to 'atuin-server-postgres')
-rw-r--r--atuin-server-postgres/src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/atuin-server-postgres/src/lib.rs b/atuin-server-postgres/src/lib.rs
index c1de4d509..1f7cf47af 100644
--- a/atuin-server-postgres/src/lib.rs
+++ b/atuin-server-postgres/src/lib.rs
@@ -290,6 +290,22 @@ impl Database for Postgres {
}
#[instrument(skip_all)]
+ async fn update_user_password(&self, user: &User) -> DbResult<()> {
+ sqlx::query(
+ "update users
+ set password = $1
+ where id = $2",
+ )
+ .bind(&user.password)
+ .bind(user.id)
+ .execute(&self.pool)
+ .await
+ .map_err(fix_error)?;
+
+ Ok(())
+ }
+
+ #[instrument(skip_all)]
async fn add_user(&self, user: &NewUser) -> DbResult<i64> {
let email: &str = &user.email;
let username: &str = &user.username;