summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb15
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/users_controller.rb2
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
3 files changed, 6 insertions, 12 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb
index a90cd7539b2..828d0f3f840 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/account_controller.rb
@@ -43,17 +43,12 @@ class AccountController < ApplicationController
def change_password
verify_post_request
if User.authenticate(current_user.login, params[:old_password], servlet_request)
- if ((params[:password] == params[:password_confirmation]))
- current_user.password = params[:password]
- current_user.password_confirmation = params[:password]
- @result = current_user.save
- if @result
- flash[:notice] = message('my_profile.password.changed')
- else
- flash[:error] = message('my_profile.password.empty')
- end
+ if params[:password].blank?
+ flash[:error] = message('my_profile.password.empty')
+ elsif current_user.update_attributes(:password => params[:password], :password_confirmation => params[:password_confirmation])
+ flash[:notice] = message('my_profile.password.changed')
else
- flash[:error] = message('my_profile.password.mismatch')
+ flash[:error] = current_user.errors.full_messages.join("<br/>\n")
end
else
flash[:error] = message('my_profile.password.wrong_old')
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/users_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/users_controller.rb
index 11e17ff729e..ba549b36f7b 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/users_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/users_controller.rb
@@ -120,7 +120,7 @@ class UsersController < ApplicationController
user = User.find(params[:id])
@user = user
if params[:user][:password].blank?
- @errors = 'Password required.'
+ @errors = message('my_profile.password.empty')
render :partial => 'users/change_password_form', :status => 400
elsif user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
flash[:notice] = 'Password was successfully updated.'
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 15d31e7e06c..96d85b86381 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1926,7 +1926,6 @@ my_profile.password.confirm=Confirm new value
my_profile.password.submit=Change password
my_profile.password.changed=Password changed
my_profile.password.empty=Password can not be empty
-my_profile.password.mismatch=Password mismatch
my_profile.password.wrong_old=Wrong old password
my_profile.notifications.submit=Save changes
my_profile.overall_notifications.title=Overall notifications