Authenticating Registrationn form in django
up vote
0
down vote
favorite
I have this html form that I want to use for signup of customers.
<form id='registration-form'>
{% csrf_token %}
<div class="form-group">
<input type="text" class="form-control input-upper" id="fullname" placeholder="John Doe" name="fullname" ><br>
<input type="text" class="form-control input-upper" id="username" placeholder="Username" name="username"><br>
<input type="email" class="form-control input-upper" id="email" placeholder="Email" name="email"><br>
<input type="text" class="form-control input-upper" id="organization" placeholder="Organization" name="organization"><br>
<input type="password" class="form-control input-upper" id="password" placeholder="Password" name="password"><br>
<input type="password" class="form-control input-upper" id="password" placeholder="Confirm Password" name="password"><br>
<small>By registering you agree to our <a href="{% url 'tos' %}">terms and conditions</a></small>
<button type="button" class="btn btn-primary btn-block btn-signup-form">SIGN UP</button>
<button type="button" class="btn btn-primary btn-block btn-sign-linkedin" href="{% url 'social:begin' 'linkedin-oauth2' %}?next={{ next }}">Sign up with LinkedIn</button>
<p class="text-already">Already have an account? <a href="">LOGIN</a></p>
</div>
</form>
How do I make an validation of the data filled i.e the email and password and I want customers to be able to log in after signing up
django
add a comment |
up vote
0
down vote
favorite
I have this html form that I want to use for signup of customers.
<form id='registration-form'>
{% csrf_token %}
<div class="form-group">
<input type="text" class="form-control input-upper" id="fullname" placeholder="John Doe" name="fullname" ><br>
<input type="text" class="form-control input-upper" id="username" placeholder="Username" name="username"><br>
<input type="email" class="form-control input-upper" id="email" placeholder="Email" name="email"><br>
<input type="text" class="form-control input-upper" id="organization" placeholder="Organization" name="organization"><br>
<input type="password" class="form-control input-upper" id="password" placeholder="Password" name="password"><br>
<input type="password" class="form-control input-upper" id="password" placeholder="Confirm Password" name="password"><br>
<small>By registering you agree to our <a href="{% url 'tos' %}">terms and conditions</a></small>
<button type="button" class="btn btn-primary btn-block btn-signup-form">SIGN UP</button>
<button type="button" class="btn btn-primary btn-block btn-sign-linkedin" href="{% url 'social:begin' 'linkedin-oauth2' %}?next={{ next }}">Sign up with LinkedIn</button>
<p class="text-already">Already have an account? <a href="">LOGIN</a></p>
</div>
</form>
How do I make an validation of the data filled i.e the email and password and I want customers to be able to log in after signing up
django
You need to use a Django form, like the UserCreationForm. Plenty of examples elsewhere online, just search "django create user form".
– YellowShark
Nov 8 at 13:23
But can I use this html template and somehow parse it into django for validation and authentication.
– David Tolu
Nov 8 at 13:38
You can! It'll leave you without some of the features that come with using forms in a template (like error messages for the individual fields), but it is technically possible to use your own HTML form, as long as you're submitting the csrf_token.
– YellowShark
Nov 8 at 13:40
okay, i have to figure that out now..thanks for pointing me in the right direction
– David Tolu
Nov 8 at 13:58
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have this html form that I want to use for signup of customers.
<form id='registration-form'>
{% csrf_token %}
<div class="form-group">
<input type="text" class="form-control input-upper" id="fullname" placeholder="John Doe" name="fullname" ><br>
<input type="text" class="form-control input-upper" id="username" placeholder="Username" name="username"><br>
<input type="email" class="form-control input-upper" id="email" placeholder="Email" name="email"><br>
<input type="text" class="form-control input-upper" id="organization" placeholder="Organization" name="organization"><br>
<input type="password" class="form-control input-upper" id="password" placeholder="Password" name="password"><br>
<input type="password" class="form-control input-upper" id="password" placeholder="Confirm Password" name="password"><br>
<small>By registering you agree to our <a href="{% url 'tos' %}">terms and conditions</a></small>
<button type="button" class="btn btn-primary btn-block btn-signup-form">SIGN UP</button>
<button type="button" class="btn btn-primary btn-block btn-sign-linkedin" href="{% url 'social:begin' 'linkedin-oauth2' %}?next={{ next }}">Sign up with LinkedIn</button>
<p class="text-already">Already have an account? <a href="">LOGIN</a></p>
</div>
</form>
How do I make an validation of the data filled i.e the email and password and I want customers to be able to log in after signing up
django
I have this html form that I want to use for signup of customers.
<form id='registration-form'>
{% csrf_token %}
<div class="form-group">
<input type="text" class="form-control input-upper" id="fullname" placeholder="John Doe" name="fullname" ><br>
<input type="text" class="form-control input-upper" id="username" placeholder="Username" name="username"><br>
<input type="email" class="form-control input-upper" id="email" placeholder="Email" name="email"><br>
<input type="text" class="form-control input-upper" id="organization" placeholder="Organization" name="organization"><br>
<input type="password" class="form-control input-upper" id="password" placeholder="Password" name="password"><br>
<input type="password" class="form-control input-upper" id="password" placeholder="Confirm Password" name="password"><br>
<small>By registering you agree to our <a href="{% url 'tos' %}">terms and conditions</a></small>
<button type="button" class="btn btn-primary btn-block btn-signup-form">SIGN UP</button>
<button type="button" class="btn btn-primary btn-block btn-sign-linkedin" href="{% url 'social:begin' 'linkedin-oauth2' %}?next={{ next }}">Sign up with LinkedIn</button>
<p class="text-already">Already have an account? <a href="">LOGIN</a></p>
</div>
</form>
How do I make an validation of the data filled i.e the email and password and I want customers to be able to log in after signing up
django
django
asked Nov 8 at 13:17
David Tolu
65
65
You need to use a Django form, like the UserCreationForm. Plenty of examples elsewhere online, just search "django create user form".
– YellowShark
Nov 8 at 13:23
But can I use this html template and somehow parse it into django for validation and authentication.
– David Tolu
Nov 8 at 13:38
You can! It'll leave you without some of the features that come with using forms in a template (like error messages for the individual fields), but it is technically possible to use your own HTML form, as long as you're submitting the csrf_token.
– YellowShark
Nov 8 at 13:40
okay, i have to figure that out now..thanks for pointing me in the right direction
– David Tolu
Nov 8 at 13:58
add a comment |
You need to use a Django form, like the UserCreationForm. Plenty of examples elsewhere online, just search "django create user form".
– YellowShark
Nov 8 at 13:23
But can I use this html template and somehow parse it into django for validation and authentication.
– David Tolu
Nov 8 at 13:38
You can! It'll leave you without some of the features that come with using forms in a template (like error messages for the individual fields), but it is technically possible to use your own HTML form, as long as you're submitting the csrf_token.
– YellowShark
Nov 8 at 13:40
okay, i have to figure that out now..thanks for pointing me in the right direction
– David Tolu
Nov 8 at 13:58
You need to use a Django form, like the UserCreationForm. Plenty of examples elsewhere online, just search "django create user form".
– YellowShark
Nov 8 at 13:23
You need to use a Django form, like the UserCreationForm. Plenty of examples elsewhere online, just search "django create user form".
– YellowShark
Nov 8 at 13:23
But can I use this html template and somehow parse it into django for validation and authentication.
– David Tolu
Nov 8 at 13:38
But can I use this html template and somehow parse it into django for validation and authentication.
– David Tolu
Nov 8 at 13:38
You can! It'll leave you without some of the features that come with using forms in a template (like error messages for the individual fields), but it is technically possible to use your own HTML form, as long as you're submitting the csrf_token.
– YellowShark
Nov 8 at 13:40
You can! It'll leave you without some of the features that come with using forms in a template (like error messages for the individual fields), but it is technically possible to use your own HTML form, as long as you're submitting the csrf_token.
– YellowShark
Nov 8 at 13:40
okay, i have to figure that out now..thanks for pointing me in the right direction
– David Tolu
Nov 8 at 13:58
okay, i have to figure that out now..thanks for pointing me in the right direction
– David Tolu
Nov 8 at 13:58
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
I'm not sure what you mean by validating data but If i got you correctly you should go for Django built in functionality for user creation. Django comes with Auth module which can reduce your lot's of effort and takes care of most of the painful parts. Just have a look on this post https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html
If you want simple validations you can use clean methods of Django Form. write one form class with the same fields as you mentioned.
EX.
Class SignupForm2(forms.ModelForm ):
class Meta:
model = User
def clean(self):
self.cleaned_data = super(SignupForm2, self).clean()
if 'captcha' in self._errors and self._errors['captcha'] != ["This field is required."]:
self._errors['captcha'] = ["Please enter a correct value"]
return self.cleaned_data
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I'm not sure what you mean by validating data but If i got you correctly you should go for Django built in functionality for user creation. Django comes with Auth module which can reduce your lot's of effort and takes care of most of the painful parts. Just have a look on this post https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html
If you want simple validations you can use clean methods of Django Form. write one form class with the same fields as you mentioned.
EX.
Class SignupForm2(forms.ModelForm ):
class Meta:
model = User
def clean(self):
self.cleaned_data = super(SignupForm2, self).clean()
if 'captcha' in self._errors and self._errors['captcha'] != ["This field is required."]:
self._errors['captcha'] = ["Please enter a correct value"]
return self.cleaned_data
add a comment |
up vote
1
down vote
I'm not sure what you mean by validating data but If i got you correctly you should go for Django built in functionality for user creation. Django comes with Auth module which can reduce your lot's of effort and takes care of most of the painful parts. Just have a look on this post https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html
If you want simple validations you can use clean methods of Django Form. write one form class with the same fields as you mentioned.
EX.
Class SignupForm2(forms.ModelForm ):
class Meta:
model = User
def clean(self):
self.cleaned_data = super(SignupForm2, self).clean()
if 'captcha' in self._errors and self._errors['captcha'] != ["This field is required."]:
self._errors['captcha'] = ["Please enter a correct value"]
return self.cleaned_data
add a comment |
up vote
1
down vote
up vote
1
down vote
I'm not sure what you mean by validating data but If i got you correctly you should go for Django built in functionality for user creation. Django comes with Auth module which can reduce your lot's of effort and takes care of most of the painful parts. Just have a look on this post https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html
If you want simple validations you can use clean methods of Django Form. write one form class with the same fields as you mentioned.
EX.
Class SignupForm2(forms.ModelForm ):
class Meta:
model = User
def clean(self):
self.cleaned_data = super(SignupForm2, self).clean()
if 'captcha' in self._errors and self._errors['captcha'] != ["This field is required."]:
self._errors['captcha'] = ["Please enter a correct value"]
return self.cleaned_data
I'm not sure what you mean by validating data but If i got you correctly you should go for Django built in functionality for user creation. Django comes with Auth module which can reduce your lot's of effort and takes care of most of the painful parts. Just have a look on this post https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html
If you want simple validations you can use clean methods of Django Form. write one form class with the same fields as you mentioned.
EX.
Class SignupForm2(forms.ModelForm ):
class Meta:
model = User
def clean(self):
self.cleaned_data = super(SignupForm2, self).clean()
if 'captcha' in self._errors and self._errors['captcha'] != ["This field is required."]:
self._errors['captcha'] = ["Please enter a correct value"]
return self.cleaned_data
answered Nov 8 at 13:54
Priyank Singh
313
313
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208554%2fauthenticating-registrationn-form-in-django%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You need to use a Django form, like the UserCreationForm. Plenty of examples elsewhere online, just search "django create user form".
– YellowShark
Nov 8 at 13:23
But can I use this html template and somehow parse it into django for validation and authentication.
– David Tolu
Nov 8 at 13:38
You can! It'll leave you without some of the features that come with using forms in a template (like error messages for the individual fields), but it is technically possible to use your own HTML form, as long as you're submitting the csrf_token.
– YellowShark
Nov 8 at 13:40
okay, i have to figure that out now..thanks for pointing me in the right direction
– David Tolu
Nov 8 at 13:58