-
-
Notifications
You must be signed in to change notification settings - Fork 468
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
No validation messages for sign up #554
Comments
Do you have a suggestion for what the flash should say? Unfortunately, I can't think of anything particularly useful that wouldn't then be an impediment for people with different sign up requirements. I thin the proper way to handle this is to customize the sign up template to display errors as you would see fit. It's a tough thing for us to do for you because error styling is generally very app-by-app. What do you think? |
Hi Derek, You are right. I did use Devise before trying out Clearance, and in Devise On Fri, May 8, 2015 at 10:51 PM, Derek Prior [email protected]
|
I posted a similar issue today with #559. I agree that perhaps there should be a default error. Even the "Bad email or password." would be good. That being said, this feels more like a form validation issue. Adding form errors in the sign up form makes some sense to me. Thoughts? |
I usually see people create a place for flash messages in Rails view layouts, as @derekprior mentioned. Looks like we are setting the flash message in the sign in form like @iamarmanjon mentioned. (reference: https://github.com/thoughtbot/clearance/blob/master/app/controllers/clearance/sessions_controller.rb#L13) - I think it makes sense to do the same in the UsersController so that the error messages display in the same way during sign up. One challenge with this is that we are using a single default failure message when a sign in fails. For a sign up form where a user record is being created, failure messages are usually determined by ActiveRecord validations. There are validations here: clearance/lib/clearance/user.rb Line 42 in aefdc07
|
@jessieay would it make sense to include form errors within the sign up form? Something like... <% if object.errors.any? %>
<h3>Please fix the following errors:</h3>
<ul>
<% object.errors.full_messages.each do |msg| %>
<li>
<%= msg %>
</li>
<% end %>
</ul>
<% end %> That should allow us to display validation errors directly in the form instead of displaying a general flash message. Thoughts? |
This is my least favorite part of Clearance to make decisions on... It's hard to get shared UI right at all. I'd be perfectly fine making some of these changes if generating the views into your own app was required and this was just a default option. But it's not required -- you can run with internal views. I like the idea of setting the flash and as @jessieay points out, we're already doing that elsewhere. But I'm just not sure what that message should actually say. I don't think I'd consider this a breaking change, though some could argue it is. Clearance already assumes you display and style flashes. If your layout doesn't show them, then you won't get them, if it does, it should be displayed acceptably. Presenting errors as @DavidVII mentions makes it obvious how to handle the messaging, but its also something I would consider a breaking change. There's no expectation for your sign up form to have styling to handle that markup in a nice way. That markup is almost exactly what |
Good points, @derekprior. I definitely think this requires some more thought. IMO, the user flow is off when using internal views or even default controllers. Clearance has user validations in place, yet we're not showing their errors by default. Not showing these error messages when a user signs up adds a hurdle to the user experience. I feel like presenting errors as I described above makes it clear why there was an interruption. Given, my idea may not be the best solution, but I definitely feel like we need something. Thoughts? |
I'm leaning towards making this a Clearance 2.0 change, adding errors to the view, and possibly requiring that views be dumped to your app and not served internally. |
+1 on requiring the views |
Hi all! For some reason when I was using clearance my Active Record validations were not showing error messages when they were being validated. I ended modifying the def create
@user = user_from_params
if @user.save
sign_in @user
redirect_back_or url_after_create
else
flash.now[:error] = @user.errors.full_messages[0]
render template: "users/new"
end
end Hopefully this applies to this discussion! |
Although the solution is easy for customized signup process, but there's no code comments or docs saying please add it yourself 😓 |
Hi, how do you guys solve this these days? just spent few hours trying to find why sign up won't show any errors :) |
When I clicked sign up when no email and password inputted, it doesn't have flash message compare like signing in. Is this normal? and I need to set my own?
The text was updated successfully, but these errors were encountered: