mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FIX: Do not raise exception if the authenticator email is missing
Followup to 296cdc53ee
This commit is contained in:
parent
92f2202e4a
commit
5755d3886f
2 changed files with 12 additions and 1 deletions
|
@ -19,7 +19,7 @@ class Auth::Result
|
||||||
end
|
end
|
||||||
|
|
||||||
def email
|
def email
|
||||||
@email.downcase
|
@email&.downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
def failed?
|
def failed?
|
||||||
|
|
|
@ -140,6 +140,17 @@ describe Auth::ManagedAuthenticator do
|
||||||
result = authenticator.after_authenticate(hash)
|
result = authenticator.after_authenticate(hash)
|
||||||
expect(result.user.id).to eq(user.id)
|
expect(result.user.id).to eq(user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'works if there is no email' do
|
||||||
|
expect {
|
||||||
|
result = authenticator.after_authenticate(hash.deep_merge(info: { email: nil }))
|
||||||
|
expect(result.user).to eq(nil)
|
||||||
|
expect(result.username).to eq("IAmGroot")
|
||||||
|
expect(result.email).to eq(nil)
|
||||||
|
}.to change { UserAssociatedAccount.count }.by(1)
|
||||||
|
expect(UserAssociatedAccount.last.user).to eq(nil)
|
||||||
|
expect(UserAssociatedAccount.last.info["nickname"]).to eq("IAmGroot")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "avatar on update" do
|
describe "avatar on update" do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue