-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perform a case-insensitive login confirmation by default
Add login_confirmation_matches? configuration method to allow for case-sensitive login confirmation.
- Loading branch information
1 parent
ff12e90
commit 6424ce7
Showing
6 changed files
with
63 additions
and
2 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
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 |
---|---|---|
|
@@ -99,6 +99,49 @@ | |
page.html.must_include("Logged In: [email protected]") | ||
end | ||
|
||
it "should do a case insensitive confirmation by default" do | ||
rodauth do | ||
enable :create_account | ||
end | ||
roda do |r| | ||
r.rodauth | ||
next unless rodauth.logged_in? | ||
r.root{view :content=>"Logged In: #{DB[:accounts].where(:id=>rodauth.session_value).get(:email)}"} | ||
end | ||
|
||
visit '/create-account' | ||
fill_in 'Login', :with=>'[email protected]' | ||
fill_in 'Confirm Login', :with=>'[email protected]' | ||
fill_in 'Password', :with=>'apple2' | ||
fill_in 'Confirm Password', :with=>'apple2' | ||
click_button 'Create Account' | ||
page.html.must_include("Logged In: [email protected]") | ||
end | ||
|
||
it "should support login_confirmation_matches? to allow for case sensitive confirmations" do | ||
rodauth do | ||
enable :create_account | ||
login_confirmation_matches? do |l, lc| | ||
l == lc | ||
end | ||
end | ||
roda do |r| | ||
r.rodauth | ||
next unless rodauth.logged_in? | ||
r.root{view :content=>"Logged In: #{DB[:accounts].where(:id=>rodauth.session_value).get(:email)}"} | ||
end | ||
|
||
visit '/create-account' | ||
fill_in 'Login', :with=>'[email protected]' | ||
fill_in 'Confirm Login', :with=>'[email protected]' | ||
fill_in 'Password', :with=>'apple2' | ||
fill_in 'Confirm Password', :with=>'apple2' | ||
click_button 'Create Account' | ||
page.html.must_include("logins do not match") | ||
page.find('#error_flash').text.must_equal "There was an error creating your account" | ||
page.current_path.must_equal '/create-account' | ||
end | ||
|
||
it "should not display create account link on login page if route is disabled" do | ||
route = 'create-account' | ||
rodauth do | ||
|