Skip to content

Commit 513e1c2

Browse files
authored
fix(login): Removes always visible login error (#263)
* fix(login): Removes always visible login error * Fixes Hound spacing requirement
1 parent 58601a1 commit 513e1c2

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

app/controllers/application_controller.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ def after_sign_in_path_for(resource)
55
stored_location = stored_location_for(resource)
66
if stored_location
77
stored_location
8-
elsif current_user.admin? || current_user.admin_limited_access?
9-
manage_root_path
108
elsif current_user.questionnaire.nil?
119
new_questionnaires_path
1210
else

app/views/devise/sessions/new.html.haml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,4 @@
33
%h1.section-title.center
44
Sign in to
55
%span.emphasized= HackathonConfig['name']
6-
- if notice
7-
.form-success
8-
.success_message
9-
%p#notice= notice
106
= render 'form'

config/routes.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99

1010
mount MailPreview => "mail_view" if Rails.env.development?
1111

12-
root to: "questionnaires#show"
12+
devise_scope :user do
13+
authenticated do
14+
root to: "questionnaires#show"
15+
end
16+
17+
unauthenticated do
18+
root to: "devise/sessions#new"
19+
end
20+
end
1321

1422
authenticate :user, ->(u) { u.admin? } do
1523
mount Sidekiq::Web => "/sidekiq"

test/integration/user_flows_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class UserFlowsTest < ActionDispatch::IntegrationTest
1212

1313
should "be able to login and browse site as an admin" do
1414
login(FactoryBot.create(:admin))
15-
assert_redirected_to manage_root_path
15+
assert_redirected_to new_questionnaires_path
1616

1717
get manage_dashboard_index_path
1818
assert_response :success

0 commit comments

Comments
 (0)