fix update id, don't update user name
This commit is contained in:
parent
603a57cf38
commit
be2528fbb4
@ -286,13 +286,9 @@ async fn update_user(
|
||||
data: web::Json<User>,
|
||||
role: AuthDetails<Role>,
|
||||
) -> Result<impl Responder, ServiceError> {
|
||||
if id.into_inner() == user.id || role.has_role(&Role::Admin) {
|
||||
if *id == user.id || role.has_role(&Role::Admin) {
|
||||
let mut fields = String::new();
|
||||
|
||||
if !data.username.is_empty() {
|
||||
fields.push_str(format!("username = '{}'", data.username).as_str());
|
||||
}
|
||||
|
||||
if let Some(mail) = data.mail.clone() {
|
||||
if !fields.is_empty() {
|
||||
fields.push_str(", ");
|
||||
@ -314,7 +310,7 @@ async fn update_user(
|
||||
fields.push_str(format!("password = '{password_hash}', salt = '{salt}'").as_str());
|
||||
}
|
||||
|
||||
if handles::update_user(&pool.into_inner(), user.id, fields)
|
||||
if handles::update_user(&pool.into_inner(), *id, fields)
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 36f0919aebc68a57b79c7dbce0e97f4abd115465
|
||||
Subproject commit e060cbe885a961f295fb4f6f12bc2c86b5f94192
|
Loading…
Reference in New Issue
Block a user