Exemple #1
0
def sign_up_view(request):
    if request.method == "POST":
        form = signup_form(request.POST)
        if form.is_valid():
            username = form.cleaned_data["username"]
            email = form.cleaned_data["email"]
            name = form.cleaned_data["name"]
            password = form.cleaned_data["password"]
            user_data = signup_form(username=username,
                                    name=name,
                                    email=email,
                                    password=make_password(password))
            user_data.save()
            return render(request, 'user_created.html')
    else:
        form = signup_form()
    return render(request, 'login/index.html', {'form': form})
Exemple #2
0
def signup(request):
    if request.method == "POST":
        form = signup_form(request.POST)

        if form.is_valid():
            from django.contrib.auth.models import User

            new_user = User.objects.create_user(request.POST["email_address"], request.POST["email_address"], request.POST["password"])
            new_user.save()

            request.session["message"] = "Thanks for signing up with Smack, you'll receive a confirmation email shortly."

            return HttpResponseRedirect('/')
    else:
        form = signup_form()

    return render(request, "signup.djhtml", { "form": form })
Exemple #3
0
def signup():
    form = signup_form(request.form)
    if request.method == 'POST':
        if form.validate():
            user = User(form.username.data, form.password.data, form.email.data, form.fname.data, form.lname.data, form.phone.data)
            db.session.add(user)
            db.session.commit()
            flash('Thanks for registering')
            return redirect(url_for('login'))
        else:
            flash('Something went wrong')
            return render_template('signup.html', form=form)
    else:
        return render_template('signup.html', form=form)