##// END OF EJS Templates
Makes the autologin cookie configurable (#1763)....
Jean-Philippe Lang -
r4636:55acbcb560cc
parent child
Show More
@@ -203,12 +203,23 class AccountController < ApplicationController
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'
211 end
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 }
221 cookies[cookie_name] = cookie_options
222 end
212
223
213 # Onthefly creation failed, display the registration form to fill/fix attributes
224 # Onthefly creation failed, display the registration form to fill/fix attributes
214 def onthefly_creation_failed(user, auth_source_options = { })
225 def onthefly_creation_failed(user, auth_source_options = { })
@@ -99,6 +99,14 default:
99 # attachments_storage_path: D:/redmine/files
99 # attachments_storage_path: D:/redmine/files
100 attachments_storage_path:
100 attachments_storage_path:
101
101
102 # Configuration of the autologin cookie.
103 # autologin_cookie_name: the name of the cookie (default: autologin)
104 # autologin_cookie_path: the cookie path (default: /)
105 # autologin_cookie_secure: true sets the cookie secure flag (default: false)
106 autologin_cookie_name:
107 autologin_cookie_path:
108 autologin_cookie_secure:
109
102 # specific configuration options for production environment
110 # specific configuration options for production environment
103 # that overrides the default ones
111 # that overrides the default ones
104 production:
112 production:
General Comments 0
You need to be logged in to leave comments. Login now