Defect #13335 ยป autologin.patch
| it-redmine/app/controllers/account_controller.rb 2013-03-01 23:01:04.642760286 -0800 | ||
|---|---|---|
|
end
|
||
|
def open_id_authenticate(openid_url)
|
||
|
authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url, :method => :post) do |result, identity_url, registration|
|
||
|
authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url(:autologin => params[:autologin]), :method => :post) do |result, identity_url, registration|
|
||
|
|
||
|
if result.successful?
|
||
|
user = User.find_or_initialize_by_identity_url(identity_url)
|
||
|
if user.new_record?
|
||
| ... | ... | |
|
def set_autologin_cookie(user)
|
||
|
token = Token.create(:user => user, :action => 'autologin')
|
||
|
cookie_name = Redmine::Configuration['autologin_cookie_name'] || 'autologin'
|
||
|
cookie_options = {
|
||
|
:value => token.value,
|
||
|
:expires => 1.year.from_now,
|
||
| ... | ... | |
|
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
||
|
:httponly => true
|
||
|
}
|
||
|
cookies[cookie_name] = cookie_options
|
||
|
cookies[autologin_cookie_name] = cookie_options
|
||
|
end
|
||
|
# Onthefly creation failed, display the registration form to fill/fix attributes
|
||
| it-redmine/app/controllers/application_controller.rb 2013-03-01 22:56:16.730748635 -0800 | ||
|---|---|---|
|
protect_from_forgery
|
||
|
def handle_unverified_request
|
||
|
super
|
||
|
cookies.delete(:autologin)
|
||
|
cookies.delete(autologin_cookie_name)
|
||
|
end
|
||
|
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
|
||
| ... | ... | |
|
user
|
||
|
end
|
||
|
def autologin_cookie_name
|
||
|
return Redmine::Configuration['autologin_cookie_name'] || 'autologin'
|
||
|
end
|
||
|
|
||
|
def try_to_autologin
|
||
|
if cookies[:autologin] && Setting.autologin?
|
||
|
if cookies[autologin_cookie_name] && Setting.autologin?
|
||
|
# auto-login feature starts a new session
|
||
|
user = User.try_to_autologin(cookies[:autologin])
|
||
|
user = User.try_to_autologin(cookies[autologin_cookie_name])
|
||
|
if user
|
||
|
reset_session
|
||
|
start_user_session(user)
|
||