BUGFIX: identity_url was not fished out correctly
If I user logged in with Google and then changed email, they would no longer be able to log in with google
This commit is contained in:
parent
49dbb992ad
commit
5897d3419c
|
@ -13,12 +13,12 @@ class Auth::OpenIdAuthenticator < Auth::Authenticator
|
|||
result = Auth::Result.new
|
||||
|
||||
data = auth_token[:info]
|
||||
identity_url = auth_token[:extra][:identity_url]
|
||||
identity_url = auth_token[:extra][:response].identity_url
|
||||
result.email = email = data[:email]
|
||||
|
||||
# If the auth supplies a name / username, use those. Otherwise start with email.
|
||||
result.name = name = data[:name] || data[:email]
|
||||
result.username = username = data[:nickname] || data[:email]
|
||||
result.name = data[:name] || data[:email]
|
||||
result.username = data[:nickname] || data[:email]
|
||||
|
||||
user_open_id = UserOpenId.find_by_url(identity_url)
|
||||
|
||||
|
@ -32,6 +32,7 @@ class Auth::OpenIdAuthenticator < Auth::Authenticator
|
|||
# note email may change by the time after_create_account runs
|
||||
email: email
|
||||
}
|
||||
|
||||
result.email_valid = @opts[:trusted]
|
||||
|
||||
result
|
||||
|
|
|
@ -12,7 +12,8 @@ describe Auth::OpenIdAuthenticator do
|
|||
auth = Auth::OpenIdAuthenticator.new("test", "id", trusted: true)
|
||||
|
||||
user = Fabricate(:user)
|
||||
result = auth.after_authenticate(info: {email: user.email}, extra: {identity_url: 'abc'})
|
||||
response = OpenStruct.new(identity_url: 'abc')
|
||||
result = auth.after_authenticate(info: {email: user.email}, extra: {response: response})
|
||||
result.user.should == user
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue