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










share|improve this question






















  • 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















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










share|improve this question






















  • 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













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










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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


















  • 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












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





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    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

























    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





    share|improve this answer

























      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





      share|improve this answer























        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





        share|improve this answer












        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






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 8 at 13:54









        Priyank Singh

        313




        313






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Schultheiß

            Verwaltungsgliederung Dänemarks

            Liste der Kulturdenkmale in Wilsdruff