Fix verified check when signing in with Google

The Google response contains an `email_verified` field instead of a
`verified_email` field, and so we weren't treating verified Google
accounts as verified.
This commit is contained in:
Javi Martín
2022-10-10 16:07:57 +02:00
parent a86792c9fa
commit 67b917db13
2 changed files with 27 additions and 1 deletions

View File

@@ -479,6 +479,31 @@ describe "Users" do
end
end
context "Google" do
let(:google_hash) do
{
uid: "12345",
info: {
name: "manuela",
email: "manuelacarmena@example.com",
email_verified: "1"
}
}
end
before { Setting["feature.google_login"] = true }
scenario "Sign in with an already registered user using a verified google account" do
OmniAuth.config.add_mock(:google_oauth2, google_hash)
create(:user, username: "manuela", email: "manuelacarmena@example.com")
visit new_user_session_path
click_link "Sign in with Google"
expect_to_be_signed_in
end
end
context "Wordpress" do
let(:wordpress_hash) do
{