mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 04:34:13 -06:00
FIX: Allow signup when auth provider supplies no email
This commit is contained in:
parent
275b748016
commit
fbf29443bd
@ -40,7 +40,7 @@ class UserAuthenticator
|
|||||||
|
|
||||||
def authenticated?
|
def authenticated?
|
||||||
return false if !@auth_result
|
return false if !@auth_result
|
||||||
return false if @auth_result.email.downcase != @user.email.downcase
|
return false if @auth_result&.email&.downcase != @user.email.downcase
|
||||||
return false if @auth_result.email_valid != true # strong check for truth, in case we have another object type
|
return false if @auth_result.email_valid != true # strong check for truth, in case we have another object type
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -1056,6 +1056,43 @@ describe UsersController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with no email in the auth payload" do
|
||||||
|
before do
|
||||||
|
OmniAuth.config.test_mode = true
|
||||||
|
OmniAuth.config.mock_auth[:twitter] = OmniAuth::AuthHash.new(
|
||||||
|
provider: 'twitter',
|
||||||
|
uid: '123545',
|
||||||
|
info: OmniAuth::AuthHash::InfoHash.new(
|
||||||
|
nickname: "testosama",
|
||||||
|
name: "Osama Test"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Rails.application.env_config["omniauth.auth"] = OmniAuth.config.mock_auth[:twitter]
|
||||||
|
SiteSetting.enable_twitter_logins = true
|
||||||
|
get "/auth/twitter/callback.json"
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Rails.application.env_config["omniauth.auth"] = OmniAuth.config.mock_auth[:twitter] = nil
|
||||||
|
OmniAuth.config.test_mode = false
|
||||||
|
end
|
||||||
|
|
||||||
|
it "will create the user successfully" do
|
||||||
|
Rails.application.env_config["omniauth.auth"].info.email = nil
|
||||||
|
|
||||||
|
post "/u.json", params: {
|
||||||
|
name: "Test Osama",
|
||||||
|
username: "testosama",
|
||||||
|
password: "strongpassword",
|
||||||
|
email: "osama@mail.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
json = response.parsed_body
|
||||||
|
expect(json['success']).to eq(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "creates user successfully but doesn't activate the account" do
|
it "creates user successfully but doesn't activate the account" do
|
||||||
|
Loading…
Reference in New Issue
Block a user