diff options
author | TymanWasTaken <ty@blahaj.land> | 2024-01-29 06:17:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 11:17:10 +0000 |
commit | 0faf414cd958137ac60a1f37288994f3a1441780 (patch) | |
tree | df7199c0366893dc393d1cc53230a8f39e88d036 /atuin-server-postgres | |
parent | e1c2b9c783587547cbf740ee76206507fbbde330 (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.rs | 16 |
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; |