mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FEATURE: raise an exception when the email is missing in the OpenId callback
This commit is contained in:
parent
1db40fce22
commit
7c65adfd6f
2 changed files with 8 additions and 1 deletions
|
@ -9,13 +9,14 @@ class Auth::OpenIdAuthenticator < Auth::Authenticator
|
|||
end
|
||||
|
||||
def after_authenticate(auth_token)
|
||||
|
||||
result = Auth::Result.new
|
||||
|
||||
data = auth_token[:info]
|
||||
identity_url = auth_token[:extra][:response].identity_url
|
||||
result.email = email = data[:email]
|
||||
|
||||
raise Discourse::InvalidParameters.new(:email) if email.blank?
|
||||
|
||||
# If the auth supplies a name / username, use those. Otherwise start with email.
|
||||
result.name = data[:name] || data[:email]
|
||||
result.username = data[:nickname] || data[:email]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue