Commit 52654766 authored by Michael Rose's avatar Michael Rose

auth: re-re-fix redirection

parent 99e65cb3
......@@ -33,14 +33,12 @@ class SsoController < DeviseController
def create_or_login
# Check for existing account with DLP id.
user = User.where(dlp_id: @jwt['dlp_id']).first
return sign_in(user, scope: :user) if user
return jwt_sign_in_and_redirect(user, 'Signed in successfully.') if user
# Check for existing account with DLP email.
user = User.where(email: @jwt['dlp_email']).first
if user
merge_user_and_login(user)
return
end
return merge_user_and_login(user) if user
# Create a new user
user = create_user_from_jwt
......@@ -50,8 +48,12 @@ class SsoController < DeviseController
def merge_user_and_login(user)
merge_user user
jwt_sign_in_and_redirect(user, "Your DLP account #{@jwt['dlp_username']} was linked to this account.")
end
def jwt_sign_in_and_redirect(user, message)
sign_in(user, scope: :user)
redirect_to root_path, notice: "Your DLP account #{@jwt['dlp_username']} was linked to this account."
redirect_to root_path, notice: message
end
def merge_user(user)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment