Esempio n. 1
0
def signup_facebook(request):
    context = RequestContext(request,
                           {'request': request,
                            'user': request.user})
    
    try:
        print request.POST
        name = request.user
        print name
        email =  request.user.email
        print email
        # session_key = request.COOKIES[settings.SESSION_COOKIE_NAME]

    except Exception as e:
        print "Cannot make account:", str(e)
        return render(request, 'feed/home.html',{})
    user_old = User.objects.filter(email= email)
    print "user = "******"USER EXISTS")
    else:
        User_object = User(name=name, email=email)#,session_id=session_key)
        User_object.save()
        user_id = (User.objects.filter(email= email)[0]).id

    
    return render(request, 'feed/project_view.html', {'user_id':user_id})
Esempio n. 2
0
def signup(request):
    print request.method
    if request.method == 'POST':
        print request.POST
        # context = RequestContext(request,
        #                        {'request': request,
        #                         'user': request.user})
        try:
            first_name = request.POST['first_name']
            last_name = request.POST['last_name']
            email=  request.POST['email']
            password = request.POST['password']
            confirm_password = request.POST['renter_password']
            # session_key = request.COOKIES[settings.SESSION_COOKIE_NAME]

            print "something shgbnmm"

            if password == confirm_password:
                print "kdfgfdkdbnkjdnbd"
                user_old = User.objects.filter(email= email)
                print user_old
                if user_old:
                    print "old user"
                    return HttpResponse("USER EXISTS")
                else:
                    print "ksjfgjkdf bd bkhd "
                    User_object = User(name=first_name, email=email, password=password)# , session_id = session_key)
                    User_object.save()
                    print "something "
                    user_id = (User.objects.filter(email= email)[0]).id
                    print user_id
                    return render(request,'feed/project_view.html', {'user_id':user_id})
            else:
                return HttpResponse("PASSWORD DO NOT MATCH")
        except Exception as e:
            return render(request,'feed/home.html', {})
    return HttpResponse('SIGNUP SUCCESSFUL')