diff --git a/warpgate-protocol-http/src/api/credentials.rs b/warpgate-protocol-http/src/api/credentials.rs index dc4c2d04..9e02165d 100644 --- a/warpgate-protocol-http/src/api/credentials.rs +++ b/warpgate-protocol-http/src/api/credentials.rs @@ -236,6 +236,12 @@ impl Api { 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 { id: Set(Uuid::new_v4()), user_id: Set(user_model.id),