Mercurial > hg > soundsoftware-site
comparison app/controllers/account_controller.rb @ 84:432bb11e0390 cannam
Merge from branch "luisf"
author | Chris Cannam |
---|---|
date | Thu, 16 Dec 2010 10:03:20 +0000 |
parents | 39db1b84d09f |
children | d1713ab10813 eeebe205a056 |
comparison
equal
deleted
inserted
replaced
76:8a49eabbb30a | 84:432bb11e0390 |
---|---|
75 end | 75 end |
76 | 76 |
77 # User self-registration | 77 # User self-registration |
78 def register | 78 def register |
79 redirect_to(home_url) && return unless Setting.self_registration? || session[:auth_source_registration] | 79 redirect_to(home_url) && return unless Setting.self_registration? || session[:auth_source_registration] |
80 | |
80 if request.get? | 81 if request.get? |
81 session[:auth_source_registration] = nil | 82 session[:auth_source_registration] = nil |
82 @user = User.new(:language => Setting.default_language) | 83 @user = User.new(:language => Setting.default_language) |
84 | |
85 @ssamr_user_details = SsamrUserDetail.new | |
86 | |
83 else | 87 else |
84 @user = User.new(params[:user]) | 88 @user = User.new(params[:user]) |
85 @user.admin = false | 89 @user.admin = false |
90 | |
86 @user.register | 91 @user.register |
92 | |
87 if session[:auth_source_registration] | 93 if session[:auth_source_registration] |
88 @user.activate | 94 @user.activate |
89 @user.login = session[:auth_source_registration][:login] | 95 @user.login = session[:auth_source_registration][:login] |
90 @user.auth_source_id = session[:auth_source_registration][:auth_source_id] | 96 @user.auth_source_id = session[:auth_source_registration][:auth_source_id] |
91 if @user.save | 97 if @user.save |
95 redirect_to :controller => 'my', :action => 'account' | 101 redirect_to :controller => 'my', :action => 'account' |
96 end | 102 end |
97 else | 103 else |
98 @user.login = params[:user][:login] | 104 @user.login = params[:user][:login] |
99 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] | 105 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] |
106 | |
107 @ssamr_user_details = SsamrUserDetail.new(params[:ssamr_user_details]) | |
108 | |
109 # associates the 2 objects | |
110 @user.ssamr_user_detail = @ssamr_user_details | |
100 | 111 |
101 case Setting.self_registration | 112 case Setting.self_registration |
102 when '1' | 113 when '1' |
103 register_by_email_activation(@user) | 114 register_by_email_activation(@user) |
104 when '3' | 115 when '3' |
255 # Manual activation by the administrator | 266 # Manual activation by the administrator |
256 # | 267 # |
257 # Pass a block for behavior when a user fails to save | 268 # Pass a block for behavior when a user fails to save |
258 def register_manually_by_administrator(user, &block) | 269 def register_manually_by_administrator(user, &block) |
259 if user.save | 270 if user.save |
271 | |
272 @ssamr_user_details.save! | |
273 | |
260 # Sends an email to the administrators | 274 # Sends an email to the administrators |
261 Mailer.deliver_account_activation_request(user) | 275 Mailer.deliver_account_activation_request(user) |
262 account_pending | 276 account_pending |
263 else | 277 else |
264 yield if block_given? | 278 yield if block_given? |