-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some email verification issues with external login providers.
- Needed to add explicit config to get "verified" information back from Facebook. - GitHub provider no longer needs explicit verified checks. - Improve error message when the email address is unverified (to provide the email address in the error message and distinguish it from the unauthorized error).
- Loading branch information
Showing
3 changed files
with
28 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,6 @@ def test_no_password_field_on_admin_forms | |
:provider => :github, | ||
:login_button_text => "Sign in with GitHub", | ||
:username_path => "info.email", | ||
:verified_path => "info.email_verified", | ||
}, | ||
{ | ||
:provider => :gitlab, | ||
|
@@ -172,7 +171,7 @@ def assert_login_nonexistent_admin(options) | |
LazyHash.add(omniauth_data, options.fetch(:username_path), "[email protected]") | ||
|
||
mock_omniauth(omniauth_data) do | ||
assert_login_forbidden(options.fetch(:login_button_text)) | ||
assert_login_forbidden(options.fetch(:login_button_text), "not authorized") | ||
end | ||
end | ||
|
||
|
@@ -183,7 +182,7 @@ def assert_login_unverified_email_login(options) | |
LazyHash.add(omniauth_data, options.fetch(:verified_path), false) | ||
|
||
mock_omniauth(omniauth_data) do | ||
assert_login_forbidden(options.fetch(:login_button_text)) | ||
assert_login_forbidden(options.fetch(:login_button_text), "not verified") | ||
end | ||
end | ||
|
||
|
@@ -193,10 +192,10 @@ def assert_login_permitted(login_button_text, admin) | |
assert_link("my_account_nav_link", :href => /#{admin.id}/, :visible => :all) | ||
end | ||
|
||
def assert_login_forbidden(login_button_text) | ||
def assert_login_forbidden(login_button_text, error_text) | ||
visit "/admin/" | ||
trigger_click_link(login_button_text) | ||
assert_text("not authorized") | ||
assert_text(error_text) | ||
refute_link("my_account_nav_link") | ||
end | ||
|
||
|