Mercurial > hg > soundsoftware-site
comparison app/controllers/.svn/text-base/account_controller.rb.svn-base @ 511:107d36338b70 live
Merge from branch "cannam"
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:43:07 +0100 |
parents | 0579821a129a |
children |
comparison
equal
deleted
inserted
replaced
451:a9f6345cb43d | 511:107d36338b70 |
---|---|
201 def successful_authentication(user) | 201 def successful_authentication(user) |
202 # Valid user | 202 # Valid user |
203 self.logged_user = user | 203 self.logged_user = user |
204 # generate a key and set cookie if autologin | 204 # generate a key and set cookie if autologin |
205 if params[:autologin] && Setting.autologin? | 205 if params[:autologin] && Setting.autologin? |
206 token = Token.create(:user => user, :action => 'autologin') | 206 set_autologin_cookie(user) |
207 cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now } | |
208 end | 207 end |
209 call_hook(:controller_account_success_authentication_after, {:user => user }) | 208 call_hook(:controller_account_success_authentication_after, {:user => user }) |
210 redirect_back_or_default :controller => 'my', :action => 'page' | 209 redirect_back_or_default :controller => 'my', :action => 'page' |
210 end | |
211 | |
212 def set_autologin_cookie(user) | |
213 token = Token.create(:user => user, :action => 'autologin') | |
214 cookie_name = Redmine::Configuration['autologin_cookie_name'] || 'autologin' | |
215 cookie_options = { | |
216 :value => token.value, | |
217 :expires => 1.year.from_now, | |
218 :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), | |
219 :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), | |
220 :httponly => true | |
221 } | |
222 cookies[cookie_name] = cookie_options | |
211 end | 223 end |
212 | 224 |
213 # Onthefly creation failed, display the registration form to fill/fix attributes | 225 # Onthefly creation failed, display the registration form to fill/fix attributes |
214 def onthefly_creation_failed(user, auth_source_options = { }) | 226 def onthefly_creation_failed(user, auth_source_options = { }) |
215 @user = user | 227 @user = user |