Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KG - Fix Login "NoMethodError" #1838

Merged
merged 1 commit into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def redirect_to_login
end

def after_sign_in_path_for(resource)
stored_location_for(resource) || root_path(srid: @service_request.id)
stored_location_for(resource) || root_path(srid: @service_request.try(:id))
end

def after_sign_out_path_for(resource)
Expand Down
10 changes: 6 additions & 4 deletions app/controllers/identities/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ def shibboleth
@identity = Identity.find_for_shibboleth_oauth(request.env["omniauth.auth"], current_identity)

if @identity.persisted?
sign_in_and_redirect @identity, :event => :authentication #this will throw if @identity is not activated
set_flash_message(:notice, :success, :kind => "Shibboleth") if is_navigational_format?
store_location_for(@identity, catalog_service_request_path(srid: params[:srid])) if params[:srid]
sign_in_and_redirect(@identity, event: :authentication) #this will throw if @identity is not activated
set_flash_message(:notice, :success, kind: "Shibboleth") if is_navigational_format?
else
session["devise.shibboleth_data"] = request.env["omniauth.auth"]
redirect_to new_identity_registration_url(srid: params[:srid])
Expand All @@ -35,8 +36,9 @@ def cas
@identity = Identity.find_for_cas_oauth(request.env['omniauth.auth'], current_identity)

if @identity.persisted?
sign_in_and_redirect @identity, :event => :authentication #this will throw if @identity is not activated
set_flash_message(:notice, :success, :kind => "CAS") if is_navigational_format?
store_location_for(@identity, catalog_service_request_path(srid: params[:srid])) if params[:srid]
sign_in_and_redirect(@identity, event: :authentication) #this will throw if @identity is not activated
set_flash_message(:notice, :success, kind: "CAS") if is_navigational_format?
else
session["devise.cas_data"] = request.env["omniauth.auth"]
redirect_to new_identity_registration_url(srid: params[:srid])
Expand Down