Skip to content

Commit

Permalink
Merge pull request #89 from tusharsadana/master
Browse files Browse the repository at this point in the history
Sign up None Fixed
  • Loading branch information
rshrc authored Jul 5, 2018
2 parents 61de4e7 + 0363bb2 commit 547f365
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 3 deletions.
Binary file modified accounts/__pycache__/forms.cpython-36.pyc
Binary file not shown.
Binary file modified accounts/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file modified accounts/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file modified accounts/__pycache__/views.cpython-36.pyc
Binary file not shown.
1 change: 0 additions & 1 deletion accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def save(self, user=None):

class RegistrationForm(UserCreationForm): # extending from superclass
email = forms.EmailField(required=True)
number = forms.RegexField(regex=r'^\+?1?\d{9,15}$')

# define meta data

Expand Down
8 changes: 6 additions & 2 deletions accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ def RegistrationView(request):
print(form.is_valid())
if form.is_valid():
print("the form is validated")

recaptcha_response = request.POST.get('g-recaptcha-response')
url = 'https://www.google.com/recaptcha/api/siteverify'
values = {
Expand All @@ -463,7 +462,7 @@ def RegistrationView(request):
return redirect('/account')
else:
messages.error(request, 'Invalid reCAPTCHA. Please try again.')
return redirect('/account')
return render(request, 'accounts/signup.html')

# this is /account
else:
Expand All @@ -472,6 +471,11 @@ def RegistrationView(request):
# this refers to the template, so accounts/reg_form.html
return render(request, 'accounts/signup.html', args)

else:
form = RegistrationForm()
args = {'form': form}
# this refers to the template, so accounts/reg_form.html
return render(request, 'accounts/signup.html', args)
# giving them the opportunity to get the form
# the else condition is working

Expand Down

0 comments on commit 547f365

Please sign in to comment.