Exemplo n.º 1
0
def signup(request):
    if request.method == "POST":
        form = SignUpForm(request.POST)
        if form.is_valid():
            instance = form.save()
            # Generate and send activation email
            _send_activation_email(instance)
            return HttpResponseRedirect("/accounts/signup/checkyouremail")
    else:
        form = SignUpForm()
    return render_to_response("myauth/signup_form.html", {"form": form}, context_instance=RequestContext(request))
Exemplo n.º 2
0
Arquivo: views.py Projeto: hxer/Demo
def signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if not form.is_valid():
            return render(request, 'myauth/signup.html', {'form': form})
        else:
            username = form.cleaned_data.get('username')
            email = form.cleaned_data.get('email')
            password = form.cleaned_data.get('password')
            User.objects.create_user(username=username, email=email, password=password)
            user = authenticate(username=username, password=password)
            login(request, user)
            return redirect('/')
    else:
        return render(request, 'myauth/signup.html', {'form': SignUpForm()})
Exemplo n.º 3
0
def sign_up(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if form.is_valid():
            form.save()
            name = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=name, password=raw_password)
            login(request, user)
            return redirect('home')
    else:
        form = SignUpForm()
    return render(request, 'myauth/signup.html', {'form': form})