This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
passwords: don't allow the portus user to reset
This commit disallows someone knowing the portus email from attempting to reset the password through the "I forgot my password" feature. This attack wouldn't work anyways because of the change introduced in 16a7b11, where updating the portus user is explicitly disabled (except when changing the secret for the password). See #1878 Signed-off-by: Miquel Sabaté Solà <[email protected]>
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
require "rails_helper" | ||
|
||
describe "Forgotten password support" do | ||
let!(:user) { create(:admin) } | ||
let!(:user) { create(:admin) } | ||
let!(:portus) { create(:admin, username: "portus", email: "[email protected]") } | ||
|
||
before do | ||
APP_CONFIG["signup"] = { "enabled" => true } | ||
|
@@ -21,6 +22,14 @@ | |
expect(page).to have_content("I forgot my password") | ||
end | ||
|
||
it "prevents the portus user from resetting the password" do | ||
visit new_user_password_path | ||
|
||
fill_in "Email", with: "[email protected]" | ||
click_button "Reset password" | ||
expect(page).to have_content("Action not allowed on this user") | ||
end | ||
|
||
it "sends the reset email when appropiate" do | ||
visit new_user_password_path | ||
|
||
|