Example #1
0
def make_fake_reg_for_admin_user(email,couhes):
    if UserRegistration.objects.filter(email=email).count() > 0:
        return    
    user = authmodels.User.objects.filter(email=email)[0]    
    ureg = UserRegistration();
    ureg.when = current_time_decimal();
    ureg.email = user.email;
    ureg.password = user.password;  ## WARNING this is a hashed password

    ## couhes handling: couhes requires first & last name 
    ureg.couhes = couhes

    ## print "user couhes is %s " % repr(type(user.couhes))
    ureg.cookie = gen_cookie();
    ureg.save();
Example #2
0
def createuser(request):
    ## as of 8.13, we now no longer require email confirmation -- we create users immediately
    ## on signup.
    
    email = request.POST['username'];
    passwd = request.POST['password'];
    
    if get_user_by_email(email) :
        response = HttpResponse("User exists", "text/html");
        response.status_code = 405;
        logevent(request,'createuser',205,email)
        return response

    user_reg = UserRegistration();
    user_reg.when = current_time_decimal();
    user_reg.email = email;
    user_reg.password = passwd;  ## this is unfortunate.
    
    ## couhes handling: couhes requires first & last name 
    user_reg.couhes = (request.POST['couhes'] == 'true'); ## assume this is boolean
    user_reg.first_name = request.POST.get('firstname',''); 
    user_reg.last_name = request.POST.get('lastname',''); 
    
    ## print "user couhes is %s " % repr(type(user.couhes))
    user_reg.cookie = gen_cookie();
    user_reg.save();

    if require_account_confirmation:
        print "New user registration is %s " % repr(user_reg);
        send_mail('Did you register for Listit?', gen_confirm_newuser_email_body(user_reg) , '*****@*****.**', (user_reg.email,), fail_silently=False)
        response = HttpResponse("UserRegistration created successfully", "text/html");    
        response.status_code = 200;
        logevent(request,'createusr',201,user_reg)
        return response

    ## else
    user = _make_user_from_registration(user_reg)
    response = HttpResponse("User created successfully", "text/html");    
    response.status_code = 200;
    logevent(request,'createusr',201,user_reg)
    return response        
Example #3
0
def createuser(request):
    ## as of 8.13, we now no longer require email confirmation -- we create users immediately
    ## on signup.

    email = request.POST['username']
    passwd = request.POST['password']

    if get_user_by_email(email):
        response = HttpResponse("User exists", "text/html")
        response.status_code = 405
        logevent(request, 'createuser', 205, email)
        return response

    user_reg = UserRegistration()
    user_reg.when = current_time_decimal()
    user_reg.email = email
    user_reg.password = passwd
    ## this is unfortunate.

    ## couhes handling: couhes requires first & last name
    user_reg.couhes = (request.POST['couhes'] == 'true')
    ## assume this is boolean
    user_reg.first_name = request.POST.get('firstname', '')
    user_reg.last_name = request.POST.get('lastname', '')

    ## print "user couhes is %s " % repr(type(user.couhes))
    user_reg.cookie = gen_cookie()
    user_reg.save()

    if require_account_confirmation:
        print "New user registration is %s " % repr(user_reg)
        send_mail('Did you register for Listit?',
                  gen_confirm_newuser_email_body(user_reg),
                  '*****@*****.**', (user_reg.email, ),
                  fail_silently=False)
        response = HttpResponse("UserRegistration created successfully",
                                "text/html")
        response.status_code = 200
        logevent(request, 'createusr', 201, user_reg)
        return response

    ## else
    user = _make_user_from_registration(user_reg)
    response = HttpResponse("User created successfully", "text/html")
    response.status_code = 200
    logevent(request, 'createusr', 201, user_reg)
    return response