Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Show the "I forgot my password" link when the signup is disabled
Browse files Browse the repository at this point in the history
This is a fix for a regression in which Portus didn't show the
"I forgot my password" link in the sign in page when the `signup` configurable
value was disabled.

Signed-off-by: Miquel Sabaté Solà <[email protected]>
  • Loading branch information
mssola committed Nov 24, 2015
1 parent c8ae810 commit 2a244c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/views/devise/sessions/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ section.row-0
- else
i.fa.fa-check Login

- if signup_enabled?
.row
.row
- if signup_enabled?
.col-sm-6.create-new-account
= link_to 'Create a new account', new_user_registration_url, class: 'btn btn-link'
.col-sm-6.forgot-password
= link_to "I forgot my password", new_user_password_path, class: 'btn btn-link'
- else
.forgot-password
= link_to "I forgot my password", new_user_password_path, class: 'btn btn-link'
- if show_first_user_alert?
.alert.alert-info
strong Note:
Expand Down
15 changes: 15 additions & 0 deletions spec/features/auth/login_feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@
expect(current_path).to eq new_user_session_path
end

scenario "Sign up is disabled", js: true do
APP_CONFIG["signup"] = { "enabled" => true }

visit root_path
expect(current_path).to eq root_path
expect(page).to have_content("Create a new account")

APP_CONFIG["signup"] = { "enabled" => false }

visit root_path
expect(current_path).to eq root_path
expect(page).to have_content("I forgot my password")
expect(page).to_not have_content("Create a new account")
end

describe "User is lockable" do
before :each do
@attempts = Devise.maximum_attempts
Expand Down

0 comments on commit 2a244c8

Please sign in to comment.