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/src | |
| parent | feat: make history list format configurable (#1638) (diff) | |
| download | atuin-0faf414cd958137ac60a1f37288994f3a1441780.zip | |
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/src')
| -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 c1de4d50..1f7cf47a 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; |
