Exemplo n.º 1
0
    def post(self, request):
        post_data = request.POST
        fname = post_data.get('fname')
        lname = post_data.get('lname')
        phone = post_data.get('phone')
        emailid = post_data.get('emailid')
        password = post_data.get('password')

        # validations
        value = {
            'fname': fname,
            'lname': lname,
            'phone': phone,
            'emailid': emailid
        }

        error_message = None

        customer = Customer(fname=fname,
                            lname=lname,
                            phone=phone,
                            emailid=emailid,
                            password=password)
        error_message = self.validateCustomer(customer)

        # saving
        if not error_message:

            print(fname, lname, phone, emailid, password)
            customer.password = make_password(customer.password)
            customer.register()
            return redirect('homepage')
        else:
            data = {'error': error_message, 'values': value}
            return render(request, 'signup.html', data)
Exemplo n.º 2
0
    def post(self, request):
        postData = request.POST
        Firstname = postData.get('Firstname')
        Lastname = postData.get('Lastname')
        phone = postData.get('phone')
        email = postData.get('email')
        password = postData.get('password')
        # validation
        value = {
            'Firstname': Firstname,
            'Lastname': Lastname,
            'phone': phone,
            'email': email
        }
        error_message = None

        customer = Customer(Firstname=Firstname,
                            Lastname=Lastname,
                            phone=phone,
                            email=email,
                            password=password)
        error_message = self.validateCustomer(customer)

        if not error_message:
            print(Firstname, Lastname, phone, email, password)
            customer.password = make_password(customer.password)
            customer.register()
            return redirect('index')
        else:
            data = {
                'error': error_message,
                'values': value
            }
            return render(request, 'signup.html', data)
Exemplo n.º 3
0
    def post(self, request):
        full_name = request.POST.get("name")
        phone = request.POST.get("c_number")
        email = request.POST.get("email")
        password = request.POST.get("password")

        customer = Customer(full_name=full_name,
                            phone=phone,
                            email=email,
                            password=password)

        values = {
            'name': full_name,
            'phone': phone,
            'email': email,
            'password': password
        }

        error = self.validateCustomer(customer)

        if not error:
            customer.password = make_password(customer.password)
            customer.register_customer()
            return redirect('homepage')
        else:
            data = {'error': error, 'values': values}
            return render(request, 'signuppage.html', data)
Exemplo n.º 4
0
    def post(self, request):
        post = request.POST
        first_name = post.get('firstname')
        last_name = post.get('lastname')
        phone = post.get('phone')
        email = post.get('email')
        password = post.get('password')

        value = {
            'first_name': first_name,
            'last_name': last_name,
            'phone': phone,
            'email': email
        }
        error_message = None
        customer = Customer(first_name=first_name,
                            last_name=last_name,
                            phone=phone,
                            email=email,
                            password=password)

        error_message = self.signup_validate(customer)

        # Saving
        if not error_message:
            print(first_name, last_name, phone, email, password)
            customer.password = make_password(customer.password)
            customer.register()
            return redirect('homepage')

        else:
            data = {
                'error': error_message,
                'values': value
            }
        return render(request, 'signup.html', data)