Exemple #1
0
def register_view(request):
    password = request.POST.get('newpassword')
    if password != request.POST.get('passcheck'):
        password = None
        return HttpResponse('passwords dont match! auth failed!')
    user = User()
    user.email = request.POST.get('email')
    user.username = user.email
    user.set_password(password)
    user.first_name = request.POST.get('first')
    user.last_name = request.POST.get('last')
    user.save()
    
    userProfile = UserProfile()
    userProfile.user = user
    userProfile.state = request.POST.get('state')
    userProfile.city = request.POST.get('city')
    userProfile.phone = request.POST.get('phone')
    userProfile.save()
    return redirect('/')