mirror of
https://github.com/warp-tech/warpgate.git
synced 2025-09-19 21:15:50 +08:00
fixed #1346 - changing own password does not remove existing passwors
This commit is contained in:
parent
39182a685e
commit
9bc1c9d40a
1 changed files with 6 additions and 0 deletions
|
@ -236,6 +236,12 @@ impl Api {
|
||||||
return Ok(ChangePasswordResponse::Unauthorized);
|
return Ok(ChangePasswordResponse::Unauthorized);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
entities::PasswordCredential::Entity::delete_many()
|
||||||
|
.filter(entities::PasswordCredential::Column::UserId.eq(user_model.id))
|
||||||
|
.exec(&*db)
|
||||||
|
.await
|
||||||
|
.map_err(WarpgateError::from)?;
|
||||||
|
|
||||||
let new_credential = entities::PasswordCredential::ActiveModel {
|
let new_credential = entities::PasswordCredential::ActiveModel {
|
||||||
id: Set(Uuid::new_v4()),
|
id: Set(Uuid::new_v4()),
|
||||||
user_id: Set(user_model.id),
|
user_id: Set(user_model.id),
|
||||||
|
|
Loading…
Add table
Reference in a new issue