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

existing email #40

Merged
merged 3 commits into from
Oct 4, 2020
Merged

existing email #40

merged 3 commits into from
Oct 4, 2020

Conversation

jamesgeddes
Copy link
Contributor

added form validation to reject existing emails. If email exists, returns "You've already registered! Please login"

Future improvements
Could easily be updated to redirect user to login once the login page exists.

@jamesgeddes
Copy link
Contributor Author

@CarwynNelson sorry for the radio silence over the past few weeks. I'll pick back up on the login form so would be grateful of your thoughts on this. only addition is the following on forms.py

def clean_email(self): if Member.objects.filter(email=self.cleaned_data['email']).exists(): raise forms.ValidationError("You've already registered! Please login") return self.cleaned_data['email']

@jamesgeddes
Copy link
Contributor Author

Just to be clear, this resolves #34

@jamesgeddes jamesgeddes linked an issue Oct 3, 2020 that may be closed by this pull request
@jamesgeddes jamesgeddes changed the title resolves #34 existing email Oct 3, 2020
@CarwynNelson
Copy link
Contributor

Looks good. Could we add in a basic automated test for this? I believe the existing form tests should be an easy place to do it.

Something along the lines of:

  1. Create a member with an email
  2. try and register with that email
  3. assert the form error was returned/thrown

I believe there are tests that do all of the above so you should be able to piece it together. If not just give me a shout :)

@jamesgeddes
Copy link
Contributor Author

Have not had a look at the automated testing. Will have a go and let you know.

@CarwynNelson CarwynNelson merged commit c554b68 into master Oct 4, 2020
@CarwynNelson CarwynNelson deleted the issue34 branch October 4, 2020 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gracefully handle existing email on registration
2 participants