@@ -203,12 +203,23 class AccountController < ApplicationController | |||
|
203 | 203 | self.logged_user = user |
|
204 | 204 | # generate a key and set cookie if autologin |
|
205 | 205 | if params[:autologin] && Setting.autologin? |
|
206 | token = Token.create(:user => user, :action => 'autologin') | |
|
207 | cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now } | |
|
206 | set_autologin_cookie(user) | |
|
208 | 207 | end |
|
209 | 208 | call_hook(:controller_account_success_authentication_after, {:user => user }) |
|
210 | 209 | redirect_back_or_default :controller => 'my', :action => 'page' |
|
211 | 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 | 224 | # Onthefly creation failed, display the registration form to fill/fix attributes |
|
214 | 225 | def onthefly_creation_failed(user, auth_source_options = { }) |
@@ -99,6 +99,14 default: | |||
|
99 | 99 | # attachments_storage_path: D:/redmine/files |
|
100 | 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 | 110 | # specific configuration options for production environment |
|
103 | 111 | # that overrides the default ones |
|
104 | 112 | production: |
General Comments 0
You need to be logged in to leave comments.
Login now