summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-21 19:22:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-21 19:22:31 +0000
commit28e4ff8957170c61f5cd0b7e7ab4f8e40e1afc80 (patch)
tree6a9c1a8d93efb60f9c5dd4193353ecfc93965fdb /app/controllers
parent3d1bd79ffb1414240c2c5c952a306056d7ad8b06 (diff)
downloadredmine-28e4ff8957170c61f5cd0b7e7ab4f8e40e1afc80.tar.gz
redmine-28e4ff8957170c61f5cd0b7e7ab4f8e40e1afc80.zip
Merged r2426 and r2484 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2512 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/users_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 4c9302824..7d0550aca 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -75,7 +75,11 @@ class UsersController < ApplicationController
@user.admin = params[:user][:admin] if params[:user][:admin]
@user.login = params[:user][:login] if params[:user][:login]
@user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless params[:password].nil? or params[:password].empty? or @user.auth_source_id
- if @user.update_attributes(params[:user])
+ @user.attributes = params[:user]
+ # Was the account actived ? (do it before User#save clears the change)
+ was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE])
+ if @user.save
+ Mailer.deliver_account_activated(@user) if was_activated
flash[:notice] = l(:notice_successful_update)
# Give a string to redirect_to otherwise it would use status param as the response code
redirect_to(url_for(:action => 'list', :status => params[:status], :page => params[:page]))