parent
6356596f08
commit
3417b2bce1
|
@ -234,7 +234,7 @@ class AccountController < ApplicationController
|
|||
end
|
||||
|
||||
def password_authentication
|
||||
user, last_login_on = User.try_to_login(params[:username], params[:password])
|
||||
user = 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, last_login_on)
|
||||
successful_authentication(user)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -291,7 +291,7 @@ class AccountController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def successful_authentication(user, last_login_on)
|
||||
def successful_authentication(user)
|
||||
logger.info "Successful authentication for '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
# Valid user
|
||||
self.logged_user = user
|
||||
|
@ -302,20 +302,16 @@ 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] && 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
|
||||
#sredirect_back_or_default User.current
|
||||
redirect_to my_account_url
|
||||
#redirect_to User.current
|
||||
end
|
||||
#根据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
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -364,11 +364,11 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
end
|
||||
unless user.nil?
|
||||
last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s
|
||||
if user && !user.new_record?
|
||||
#last_login_on = user.last_login_on.nil? ? '' : user.last_login_on.to_s
|
||||
user.update_column(:last_login_on, Time.now)
|
||||
end
|
||||
user.update_column(:last_login_on, Time.now) if user && !user.new_record?
|
||||
[user, last_login_on]
|
||||
user
|
||||
rescue => text
|
||||
raise text
|
||||
end
|
||||
|
|
|
@ -20,7 +20,10 @@
|
|||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
|
||||
</head>
|
||||
<div id="login-form">
|
||||
<%= form_tag(signin_path) do %>
|
||||
<%= back_url_hidden_field_tag %>
|
||||
|
|
Loading…
Reference in New Issue