Skip to content

Commit

Permalink
Show error message when login does not work (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinthinks authored Sep 27, 2023
1 parent 1d5e2b1 commit dfccfc9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
8 changes: 8 additions & 0 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
<h1 class="mb-1 fw-bold">Sign in</h1>
<span>Don’t have an account? <%= link_to "Sign up", new_user_registration_path, class: 'small fw-bold' %></span>
</div>

<div>
<% if flash[:alert] %>
<div class="alert alert-danger" role="alert">
<%= alert %>
</div>
<% end%>
</div>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: 'form-control' %>
Expand Down
16 changes: 1 addition & 15 deletions app/views/layouts/devise.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@
<body>
<main>
<div>
<% if flash[:notice] %>
<div class="flash-notice bigger">
<%= notice %>
</div>
<% end %>

<% if flash[:alert] %>
<div class="flash-alert bigger">
<%= alert %>
</div>
<% end%>

<div>
<%= yield %>
</div>
<%= yield %>
</div>
</main>
</body>
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,7 @@

# added to prevent turbo conflict
config.navigational_formats = ["*/*", :html, :turbo_stream]

config.responder.error_status = :unprocessable_entity
config.responder.redirect_status = :see_other
end

0 comments on commit dfccfc9

Please sign in to comment.