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

Repeated responses for email already taken #108

Open
AaronSofaer opened this issue Jan 7, 2016 · 3 comments
Open

Repeated responses for email already taken #108

AaronSofaer opened this issue Jan 7, 2016 · 3 comments
Labels

Comments

@AaronSofaer
Copy link

Per @patrickcousins the API is returning "Email is already taken" repeatedly. Previously filed on Android, Bernie-2016/fieldthebern-android#288.

@AaronSofaer AaronSofaer added the bug label Jan 7, 2016
@christopherstyles
Copy link

This may be a silly question, but was the email address already used to create an account prior to seeing the error? Looking at the issue on Bernie-2016/fieldthebern-android#288, it seems you may have already signed up with [email protected] before? If that’s the case, then the API response is correct, as email addresses must be unique for each user.

@patrickcousins
Copy link
Collaborator

The issue I think is that the API returns an error with the message repeated twice (or title/message are the same or something like that).

So to the user sees something like this in a single dialog box/message:

Email is already taken
Email is already taken

It's just that the error message looks silly, but the API did behave correctly.

@christopherstyles
Copy link

Aha! Thanks so much for the clarification, I’m able to reproduce it. PR on its way.

christopherstyles added a commit to christopherstyles/fieldthebern-api that referenced this issue Feb 14, 2016
A uniqueness validation for the user `email` attribute has already been
added by the `Clearance::User::Validations` module in
[clearance/user.rb#L144-L148](https://github.com/thoughtbot/clearance/bl
ob/3e9529a643cff20beb9bb49eacedb90dee49d465/lib/clearance/user.rb#L144-L
148). Duplicating the validation rule was resulting in duplicate error
responses from the API.

In addition, there is no need to specify a `case_sensitive` property
for the uniqueness validation on _non-text_ columns (the email column
type is `varchar`), as it is ignored.

This update removes the redundant uniqueness validation for
`user#email`, therefore preventing multiple email validation errors
that were occurring in API responses.

Closes Bernie-2016#108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants