Esempio n. 1
0
def landing(request):
    context = RequestContext(request)
    abc = JoinForm(request.POST or None)
    if abc.is_valid():
        new_join = abc.save(commit=False)
        new_join.save()
    return render_to_response('pages/landing.html', locals(), context)
Esempio n. 2
0
def survey_submit(request):

    if request.method == 'POST':
        abc = JoinForm(request.POST or None)
        if abc.is_valid():
            # new_join = abc.save(commit=False)
            # new_join.save()
            # modules = request.POST.get('modules', '')
            # interests = request.POST.get('interests', '')
            #referral = request.POST.get('referral', '')
            # join = Join.objects.get(id=)
            # join.modules.add(module)

            # test = authenticate(referral=referral)
            # if test is not None:
            #     login(request, test)
            args = {}
            args.update(csrf(request))
            return render_to_response(request, 'pages/thankyou.html', args)

    args = {}
    args.update(csrf(request))
    return render_to_response(request, 'pages/uhoh.html', args)
Esempio n. 3
0
def landing_request(request):
    # A boolean value for telling the template whether the registration was successful.
    # Set to False initially. Code changes value to True when registration succeeds.
    #registered = False

    errorMsg = ''
    EM = ''

    # if request.method == 'POST':
    #     userform = UserCreationForm(request.POST)
    #     username = request.POST.get('email', '')
    #     EM = EM + username
    #     if userform.is_valid():
    #         user = userform.save()
    #         u = UserProfile(userId=username)
    #         u.save()

    #         # hash_code = 'jdjsaksdhbqe3742ejs' # Something random
    #         # password = '******'
    #         password = User.objects.make_random_password()
    #         user = authenticate(username=username, password=password)
    #         # if user is None:
    #         #     return Invalid Email # Popup or something
    #         if user is not None:
    #             login(request, user)
    #         args = {}
    #         args.update(csrf(request))
    #         args['EM'] = EM

    #         # args['modules']= Module.objects.all()
    #         # args['interests']= Interest.objects.all()

    #         # Hash email
    #         # XOR is just some XOR based map
    #         # not sure of the exact operation, but it needs to be XOR based
    #         # Not an AND or OR
    #         # password = hash(email) XOR hash_code

    #         # Now we have the username (email)
    #         # and the password (hashed stuff)
    #         # So make the actual user

    #         # Make user_form
    #         # DON'T KNOW HOW TO DO THIS EXACTLY
    #         # IT WILL INVOLVE PACKAGING UP THE 
    #         # USERNAME AND PASSWORD INTO 
    #         # user = user_form.save()
    #         # u = UserProfile(userId=email)
    #         # u.save()

    #         #Send email
    #         # subject = 'Thank you for your interest!'
    #         # message = 'Hi There,\n\nThank you! You\'ve been added to the SignSchool waitlist.\n\nInterested in priority access?\nGet early access by referring your friends. For more details, visit: http://signschool.herokuapp.com/thankyou\n\nSincerely,\nThe SignSchool Team\nhttp://signschool.herokuapp.com'
    #         # from_email = settings.EMAIL_HOST_USER
    #         # to_list = [email]
    #         #send_mail(subject, message, from_email, to_list, fail_silently=True)
    #         return render(request, 'pages/hello.html', args)
    #     else:
    #         errorMsg = errorMsg + 'is invalid or has already been put on the wait list.\n'

    # args = {}
    # args.update(csrf(request))
    # args['errorMsg'] = errorMsg
    # args['EM'] = EM
    # return render(request, 'pages/landing.html',args)

    if request.method == 'POST':
        abc = JoinForm(request.POST or None)
        EM = EM + request.POST.get('email', '')
        if abc.is_valid():
            new_join = abc.save(commit=False)
            new_join.save()
            email = request.POST.get('email', '')
            password = '******'

            subject = 'Thank you for your interest!'
            message = 'Hi There,\n\nThank you! You\'ve been added to the SignSchool waitlist.\n\nInterested in priority access?\nGet early access by referring your friends. For more details, visit: http://signschool.herokuapp.com/thankyou\n\nSincerely,\nThe SignSchool Team\nhttp://signschool.herokuapp.com'
            from_email = settings.EMAIL_HOST_USER
            to_list = [email]
            # send_mail(subject, message, from_email, to_list, fail_silently=True)

            test = authenticate(email=email)
            if test is not None:
                login(request, test)
            args = {}
            args.update(csrf(request))
            args['EM'] = EM
            # args['modules']= Module.objects.all()
            # args['interests']= Interest.objects.all()
            
            return render(request, 'pages/hello.html', args)
        else:
            errorMsg = errorMsg + 'is invalid or has already been put on the wait list.\n'

    args = {}
    args.update(csrf(request))
    args['errorMsg'] = errorMsg
    args['EM'] = EM
    return render(request, 'pages/landing.html', args)