Skip to content

Commit

Permalink
Remove redundant OpenID URL expansion code
Browse files Browse the repository at this point in the history
It was only used for Google who have long since dropped OpenID support.
  • Loading branch information
tomhughes committed Jan 4, 2022
1 parent 059e3be commit d233781
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions app/controllers/concerns/session_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module SessionMethods
def auth_url(provider, uid, referer = nil)
params = { :provider => provider }

params[:openid_url] = openid_expand_url(uid) if provider == "openid"
params[:openid_url] = uid if provider == "openid"

if referer.nil?
params[:origin] = request.path
Expand All @@ -20,23 +20,6 @@ def auth_url(provider, uid, referer = nil)
auth_path(params)
end

##
# special case some common OpenID providers by applying heuristics to
# try and come up with the correct URL based on what the user entered
def openid_expand_url(openid_url)
if openid_url.nil?
nil
elsif openid_url.match(%r{(.*)gmail.com(/?)$}) || openid_url.match(%r{(.*)googlemail.com(/?)$})
# Special case gmail.com as it is potentially a popular OpenID
# provider and, unlike yahoo.com, where it works automatically, Google
# have hidden their OpenID endpoint somewhere obscure this making it
# somewhat less user friendly.
"https://www.google.com/accounts/o8/id"
else
openid_url
end
end

##
# process a successful login
def successful_login(user, referer = nil)
Expand Down

0 comments on commit d233781

Please sign in to comment.