Fix all the errors to get our tests green on Rails 5.1.

This commit is contained in:
Guo Xiang Tan
2017-08-31 12:06:56 +08:00
parent 898ee93547
commit 77d4c4d8dc
989 changed files with 5114 additions and 3117 deletions

View File

@ -4,12 +4,12 @@ require_dependency 'single_sign_on'
class SessionController < ApplicationController
class LocalLoginNotAllowed < StandardError; end
rescue_from LocalLoginNotAllowed do
render nothing: true, status: 500
render body: nil, status: 500
end
before_filter :check_local_login_allowed, only: %i(create forgot_password)
skip_before_filter :redirect_to_login_if_required
skip_before_filter :preload_json, :check_xhr, only: ['sso', 'sso_login', 'become', 'sso_provider', 'destroy']
before_action :check_local_login_allowed, only: %i(create forgot_password)
skip_before_action :redirect_to_login_if_required
skip_before_action :preload_json, :check_xhr, only: ['sso', 'sso_login', 'become', 'sso_provider', 'destroy']
ACTIVATE_USER_KEY = "activate_user"
@ -36,7 +36,7 @@ class SessionController < ApplicationController
end
redirect_to sso.to_url
else
render nothing: true, status: 404
render body: nil, status: 404
end
end
@ -67,7 +67,7 @@ class SessionController < ApplicationController
redirect_to path('/login')
end
else
render nothing: true, status: 404
render body: nil, status: 404
end
end
@ -261,7 +261,7 @@ class SessionController < ApplicationController
if current_user.present?
render_serialized(current_user, CurrentUserSerializer)
else
render nothing: true, status: 404
render body: nil, status: 404
end
end
@ -269,7 +269,7 @@ class SessionController < ApplicationController
reset_session
log_off_user
if request.xhr?
render nothing: true
render body: nil
else
redirect_to (params[:return_url] || path("/"))
end
@ -331,8 +331,9 @@ class SessionController < ApplicationController
if payload = session.delete(:sso_payload)
sso_provider(payload)
else
render_serialized(user, UserSerializer)
end
render_serialized(user, UserSerializer)
end
def render_sso_error(status:, text:)