Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
3417b2bce1
commit
949867c50b
|
@ -234,7 +234,7 @@ class AccountController < ApplicationController
|
|||
end
|
||||
|
||||
def password_authentication
|
||||
user = User.try_to_login(params[:username], params[:password])
|
||||
user, last_login_on = User.try_to_login(params[:username], params[:password])
|
||||
|
||||
if user.nil?
|
||||
invalid_credentials
|
||||
|
@ -244,7 +244,7 @@ class AccountController < ApplicationController
|
|||
onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id })
|
||||
else
|
||||
# Valid user
|
||||
successful_authentication(user)
|
||||
successful_authentication(user, last_login_on)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -291,7 +291,7 @@ class AccountController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def successful_authentication(user)
|
||||
def successful_authentication(user, last_login_on)
|
||||
logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
# Valid user
|
||||
self.logged_user = user
|
||||
|
@ -302,16 +302,20 @@ class AccountController < ApplicationController
|
|||
call_hook(:controller_account_success_authentication_after, {:user => user })
|
||||
|
||||
code = /\d*/
|
||||
#根据home_url生产正则表达式
|
||||
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
||||
if code=~params[:back_url]
|
||||
redirect_to user_activities_path(user)
|
||||
else
|
||||
|
||||
#by young
|
||||
#redirect_back_or_default my_page_path
|
||||
redirect_back_or_default User.current
|
||||
|
||||
#根据home_url生产正则表达式
|
||||
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
||||
if code=~params[:back_url] && last_login_on != ''
|
||||
redirect_to user_activities_path(user)
|
||||
else
|
||||
if last_login_on == ''
|
||||
redirect_to my_account_url
|
||||
else
|
||||
#by young
|
||||
#redirect_back_or_default my_page_path
|
||||
redirect_back_or_default User.current
|
||||
#redirect_to my_account_url
|
||||
#redirect_to User.current
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -365,10 +365,10 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
if user && !user.new_record?
|
||||
#last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s
|
||||
last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s
|
||||
user.update_column(:last_login_on, Time.now)
|
||||
end
|
||||
user
|
||||
[user, last_login_on]
|
||||
rescue => text
|
||||
raise text
|
||||
end
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
/* Redmine - project management software
|
||||
Copyright (C) 2006-2013 Jean-Philippe Lang */
|
||||
|
||||
$(function() {
|
||||
$.ajaxSetup({
|
||||
beforeSend: function ( xhr ) {
|
||||
xhr.setRequestHeader("Accept", "text/javascript")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function cleanArray (actual){
|
||||
var newArray = new Array();
|
||||
for (var i = 0; i< actual.length; i++){
|
||||
|
|
Loading…
Reference in New Issue