Mercurial > hg > soundsoftware-site
comparison app/controllers/account_controller.rb @ 246:eeebe205a056 cannam
* Merge from default branch, bringing us up to SVN trunk rev 4993
author | Chris Cannam |
---|---|
date | Thu, 03 Mar 2011 12:02:03 +0000 |
parents | 39db1b84d09f 0579821a129a |
children | 73ff0e6a11b1 |
comparison
equal
deleted
inserted
replaced
138:fca2657f4aa5 | 246:eeebe205a056 |
---|---|
212 def successful_authentication(user) | 212 def successful_authentication(user) |
213 # Valid user | 213 # Valid user |
214 self.logged_user = user | 214 self.logged_user = user |
215 # generate a key and set cookie if autologin | 215 # generate a key and set cookie if autologin |
216 if params[:autologin] && Setting.autologin? | 216 if params[:autologin] && Setting.autologin? |
217 token = Token.create(:user => user, :action => 'autologin') | 217 set_autologin_cookie(user) |
218 cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now } | |
219 end | 218 end |
220 call_hook(:controller_account_success_authentication_after, {:user => user }) | 219 call_hook(:controller_account_success_authentication_after, {:user => user }) |
221 redirect_back_or_default :controller => 'my', :action => 'page' | 220 redirect_back_or_default :controller => 'my', :action => 'page' |
221 end | |
222 | |
223 def set_autologin_cookie(user) | |
224 token = Token.create(:user => user, :action => 'autologin') | |
225 cookie_name = Redmine::Configuration['autologin_cookie_name'] || 'autologin' | |
226 cookie_options = { | |
227 :value => token.value, | |
228 :expires => 1.year.from_now, | |
229 :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), | |
230 :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), | |
231 :httponly => true | |
232 } | |
233 cookies[cookie_name] = cookie_options | |
222 end | 234 end |
223 | 235 |
224 # Onthefly creation failed, display the registration form to fill/fix attributes | 236 # Onthefly creation failed, display the registration form to fill/fix attributes |
225 def onthefly_creation_failed(user, auth_source_options = { }) | 237 def onthefly_creation_failed(user, auth_source_options = { }) |
226 @user = user | 238 @user = user |