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')
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.'
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