evalentini / actprep

ACT test prep app
1 stars 0 forks source link

Display invalid login error message. #9

Closed evalentini closed 11 years ago

evalentini commented 11 years ago

An error bar should display at the top of the login page when a user tries to login with invalid credentials. Currently user is redirected to the login page with no explanation provided.

MattCowski commented 11 years ago

rails returns the error messages after calling .errors.full_messages method. So:

<%= render 'shared/error_messages', object: f.object %>

and we'll make a partial:

<% if object.errors.any? %>
  <div id="error_explanation">
    <div class="alert alert-error">
      The form contains <%= pluralize(object.errors.count, "error") %>.
    </div>
    <ul>
    <% object.errors.full_messages.each do |msg| %>
      <li>* <%= msg %></li>
    <% end %>
    </ul>
  </div>
<% end %>

(I'll add this code once I get through this psql issue)