FIX 修复home主页链接错误问题

This commit is contained in:
Jasder 2019-10-18 13:55:20 +08:00
parent 80b64f260d
commit 0cc06409c1
3 changed files with 21 additions and 21 deletions

View File

@ -134,7 +134,7 @@ class AccountController < ApplicationController
Mailer.run.lost_password(token)
flash[:notice] = l(:notice_account_lost_email_sent)
redirect_to lost_password_path
return
return
end
end
render :layout => 'static_base'
@ -379,7 +379,7 @@ class AccountController < ApplicationController
def password_authentication
user, last_login_on = User.try_to_login(params[:username], params[:password])
if user.nil?
invalid_credentials
elsif user.status == 2
@ -447,8 +447,8 @@ class AccountController < ApplicationController
call_hook(:controller_account_success_authentication_after, {:user => user })
code = /\d*/
#根据home_url生产正则表达式
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
#根据homes_url生产正则表达式
eval("code = " + "/^" + homes_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != ''
redirect_to user_activities_path(user,host: Setting.host_user)
elsif params[:back_url64]
@ -502,7 +502,7 @@ class AccountController < ApplicationController
# render :layout => 'login'
redirect_to signin_path(:login=>true)
end
def invalid_credentials_new
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
# flash[:error] = l(:notice_account_invalid_creditentials_new)

View File

@ -2,7 +2,7 @@ xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.title @title
xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false)
xml.link "rel" => "alternate", "href" => home_url(:only_path => false)
xml.link "rel" => "alternate", "href" => homes_url(:only_path => false)
xml.id url_for(:controller => 'welcome', :only_path => false)
xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
xml.author { xml.name "#{Setting.app_title}" }

View File

@ -40,17 +40,17 @@ class AccountControllerOpenidTest < ActionController::TestCase
:identity_url => 'http://openid.example.com/good_user')
existing_user.login = 'cool_user'
assert existing_user.save!
post :login, :openid_url => existing_user.identity_url
assert_redirected_to '/my/page'
end
def test_login_with_invalid_openid_provider
Setting.self_registration = '0'
post :login, :openid_url => 'http;//openid.example.com/good_user'
assert_redirected_to home_url
assert_redirected_to homes_url
end
def test_login_with_openid_for_existing_non_active_user
Setting.self_registration = '2'
existing_user = User.new(:firstname => 'Cool',
@ -60,11 +60,11 @@ class AccountControllerOpenidTest < ActionController::TestCase
:status => User::STATUS_REGISTERED)
existing_user.login = 'cool_user'
assert existing_user.save!
post :login, :openid_url => existing_user.identity_url
assert_redirected_to '/login'
end
def test_login_with_openid_with_new_user_created
Setting.self_registration = '3'
post :login, :openid_url => 'http://openid.example.com/good_user'
@ -74,26 +74,26 @@ class AccountControllerOpenidTest < ActionController::TestCase
assert_equal 'Cool', user.firstname
assert_equal 'User', user.lastname
end
def test_login_with_openid_with_new_user_and_self_registration_off
Setting.self_registration = '0'
post :login, :openid_url => 'http://openid.example.com/good_user'
assert_redirected_to home_url
assert_redirected_to homes_url
user = User.find_by_login('cool_user')
assert_nil user
end
def test_login_with_openid_with_new_user_created_with_email_activation_should_have_a_token
Setting.self_registration = '1'
post :login, :openid_url => 'http://openid.example.com/good_user'
assert_redirected_to '/login'
user = User.find_by_login('cool_user')
assert user
token = Token.find_by_user_id_and_action(user.id, 'register')
assert token
end
def test_login_with_openid_with_new_user_created_with_manual_activation
Setting.self_registration = '2'
post :login, :openid_url => 'http://openid.example.com/good_user'
@ -102,23 +102,23 @@ class AccountControllerOpenidTest < ActionController::TestCase
assert user
assert_equal User::STATUS_REGISTERED, user.status
end
def test_login_with_openid_with_new_user_with_conflict_should_register
Setting.self_registration = '3'
existing_user = User.new(:firstname => 'Cool', :lastname => 'User', :mail => 'user@somedomain.com')
existing_user.login = 'cool_user'
assert existing_user.save!
post :login, :openid_url => 'http://openid.example.com/good_user'
assert_response :success
assert_template 'register'
assert assigns(:user)
assert_equal 'http://openid.example.com/good_user', assigns(:user)[:identity_url]
end
def test_login_with_openid_with_new_user_with_missing_information_should_register
Setting.self_registration = '3'
post :login, :openid_url => 'http://openid.example.com/good_blank_user'
assert_response :success
assert_template 'register'