Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Specific Error Messages in New User View #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ hold once a week.

## Dev Requirements

* Ruby 2.7.2
* Yarn
* Ruby 2.7.3
* Yarn with Node.js v14
Comment on lines +8 to +9
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind pulling these out into a separate PR?

* PostgreSQL 11

## Setup
Expand Down
4 changes: 3 additions & 1 deletion app/views/users/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

<% if @user.errors.present? %>
<div class="errors">
Please fill out all fields
<% @user.errors.full_messages.each do |error_message| %>
<%= error_message %>
<% end %>
Comment on lines +6 to +8
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, but I wonder if we want to exclude the error message that says the email address is already taken. It feels like it might be responsible not to expose that information to anyone trying to use the sign up form. I think there are a few ways we could do this:

  1. We can pair the errors with their respective fields (e.g., errors for first name next to the first name field and so on).
  2. We might be able to filter out that error in particular.
  3. We can stick to the original generic error, and modify it a bit:
All fields are required. If you're having trouble, make sure you don't already have an account with the same email. Reset your password here

And we could link them to the password reset form in that message.

I'm partial to 1 or 2, but 3 is super easy. Thoughts?

</div>
<% end %>

Expand Down