{"record":{"id":"cb92e31312aca0a7","repo":"portainer/portainer","slug":"current-password-doesn-t-match-password-left-unch","errorCode":null,"errorMessage":"Current password doesn't match. Password left unchanged","messagePattern":"Current password doesn't match\\. Password left unchanged","errorType":"http","errorClass":"httperror.HandlerError","httpStatus":403,"severity":"error","filePath":"api/http/handler/users/user_update.go","lineNumber":122,"sourceCode":"\t\t\treturn httperror.Conflict(\"Another user with the same username already exists\", errUserAlreadyExists)\n\t\t}\n\n\t\tuser.Username = payload.Username\n\t}\n\n\tif payload.Password != \"\" && payload.NewPassword == \"\" {\n\t\tif tokenData.Role == portainer.AdministratorRole {\n\t\t\treturn httperror.BadRequest(\"Existing password field specified without new password field.\", errors.New(\"To change the password as an admin, you only need 'newPassword' in your request\"))\n\t\t}\n\n\t\treturn httperror.BadRequest(\"Existing password field specified without new password field.\", errors.New(\"To change the password, you must include both 'password' and 'newPassword' in your request\"))\n\t}\n\n\tif payload.NewPassword != \"\" {\n\t\t// Non-admins need to supply the previous password\n\t\tif tokenData.Role != portainer.AdministratorRole {\n\t\t\tif err := handler.CryptoService.CompareHashAndData(user.Password, payload.Password); err != nil {\n\t\t\t\treturn httperror.Forbidden(\"Current password doesn't match. Password left unchanged\", errors.New(\"Current password does not match the password provided. Please try again\"))\n\t\t\t}\n\t\t}\n\n\t\tif !handler.passwordStrengthChecker.Check(payload.NewPassword) {\n\t\t\treturn httperror.BadRequest(\"Password does not meet the minimum strength requirements\", nil)\n\t\t}\n\n\t\tuser.Password, err = handler.CryptoService.Hash(payload.NewPassword)\n\t\tif err != nil {\n\t\t\treturn httperror.InternalServerError(\"Unable to hash user password\", errCryptoHashFailure)\n\t\t}\n\t\tuser.TokenIssueAt = time.Now().Unix()\n\t}\n\n\tif payload.Theme != nil {\n\t\tuser.ThemeSettings.Color = *cmp.Or(payload.Theme.Color, &user.ThemeSettings.Color)\n\t}\n","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/http/handler/users/user_update.go#L104-L140","documentation":"Error \"Current password doesn't match. Password left unchanged\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/http/handler/users/user_update.go:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}