Beispiel #1
0
def confirmuser(request):
    cookie = request.GET['cookie']
    matching_registrations = UserRegistration.objects.filter(cookie=cookie)
    if len(matching_registrations) > 0:
        newest_registration = get_most_recent(matching_registrations)
        user = _make_user_from_registration(newest_registration)
        user.first_name = newest_registration.first_name
        user.last_name = newest_registration.last_name
        user.save()
        logevent(request, 'confirmuser', 200, user)
        return render_to_response(
            'jv3/confirmuser.html', {
                'message':
                "Okay, thank you for confirming that you are a human, %s.  You can now synchronize with List.it. "
                % user.email,
                'username':
                user.email,
                'password':
                newest_registration.password,
                'server':
                settings.SERVER_URL
            })

    response = render_to_response(
        'jv3/confirmuser.html',
        {'message': "Oops, could not figure out what you are talking about!"})
    response.status_code = 405
    logevent(request, 'confirmuser', 405, request)
    return response
Beispiel #2
0
def get_user_and_registration_from_cookie(cookie,request):
    registration = get_most_recent(UserRegistration.objects.filter(cookie=cookie))
    # user not found?
    if (not registration or len(UserRegistration.objects.filter(cookie=cookie)) == 0):
        return None
    matching_user = get_user_by_email(registration.email)
    if not matching_user:
        return None
    return (matching_user, registration)
Beispiel #3
0
def get_user_and_registration_from_cookie(cookie, request):
    registration = get_most_recent(
        UserRegistration.objects.filter(cookie=cookie))
    # user not found?
    if (not registration
            or len(UserRegistration.objects.filter(cookie=cookie)) == 0):
        return None
    matching_user = get_user_by_email(registration.email)
    if not matching_user:
        return None
    return (matching_user, registration)
Beispiel #4
0
 def _get_max_helper(self,user,clientid):
     if self._get_cached_activity_log_stats(user,clientid).count() == 0:
         print "actloghelper nothing cached for",user,clientid,
         user_activity = self._get_activity_logs(user,clientid)
         most_recent_activity = get_most_recent(user_activity)
         # compute manually
         if most_recent_activity:
             maxdate,count = long(most_recent_activity.when),len(user_activity)
             self._set_maxdate_count_for_user(user,clientid,maxdate)
             return maxdate,count
         return 0,0
     print "actloghelper cached ",user,clientid, "!",
     cals = self._get_cached_activity_log_stats(user,clientid).order_by('-count')[0]
     return cals.maxdate,cals.count
Beispiel #5
0
def reconsent(request):
    email = request.GET['email']
    newest_registration  = get_most_recent(UserRegistration.objects.filter(email__iexact=email))
    if newest_registration:
        logevent(request,'reconsent',200,newest_registration)
        newest_registration.couhes = True
        newest_registration.when = current_time_decimal() ## update time 
        newest_registration.save()
        return render_to_response('jv3/confirmuser.html',
                                  {'message': "Great! Thank you for signing back up for our study. If you would like to set up your client or re-install list it, use the links below. ",
                                   "username":email, 'password':newest_registration.password, 'server':settings.SERVER_URL})
    response = render_to_response('/500.html');
    response.status_code = 500;
    logevent(request,'reconsent',500,request)
    return response
Beispiel #6
0
 def _get_max_helper(self, user, clientid):
     if self._get_cached_activity_log_stats(user, clientid).count() == 0:
         print "actloghelper nothing cached for", user, clientid,
         user_activity = self._get_activity_logs(user, clientid)
         most_recent_activity = get_most_recent(user_activity)
         # compute manually
         if most_recent_activity:
             maxdate, count = long(
                 most_recent_activity.when), len(user_activity)
             self._set_maxdate_count_for_user(user, clientid, maxdate)
             return maxdate, count
         return 0, 0
     print "actloghelper cached ", user, clientid, "!",
     cals = self._get_cached_activity_log_stats(
         user, clientid).order_by('-count')[0]
     return cals.maxdate, cals.count
Beispiel #7
0
def confirmuser(request):
    cookie = request.GET['cookie'];
    matching_registrations = UserRegistration.objects.filter(cookie=cookie)
    if len(matching_registrations) > 0:
        newest_registration = get_most_recent(matching_registrations)
        user= _make_user_from_registration(newest_registration)
        user.first_name = newest_registration.first_name
        user.last_name = newest_registration.last_name
        user.save()
        logevent(request,'confirmuser',200,user)
        return render_to_response('jv3/confirmuser.html', {'message': "Okay, thank you for confirming that you are a human, %s.  You can now synchronize with List.it. " % user.email,
                                                           'username':user.email, 'password':newest_registration.password, 'server':settings.SERVER_URL});
    
    response = render_to_response('jv3/confirmuser.html', {'message': "Oops, could not figure out what you are talking about!"});
    response.status_code = 405;
    logevent(request,'confirmuser',405,request)
    return response
Beispiel #8
0
def reconsent(request):
    email = request.GET['email']
    newest_registration = get_most_recent(
        UserRegistration.objects.filter(email__iexact=email))
    if newest_registration:
        logevent(request, 'reconsent', 200, newest_registration)
        newest_registration.couhes = True
        newest_registration.when = current_time_decimal()  ## update time
        newest_registration.save()
        return render_to_response(
            'jv3/confirmuser.html', {
                'message':
                "Great! Thank you for signing back up for our study. If you would like to set up your client or re-install list it, use the links below. ",
                "username": email,
                'password': newest_registration.password,
                'server': settings.SERVER_URL
            })
    response = render_to_response('/500.html')
    response.status_code = 500
    logevent(request, 'reconsent', 500, request)
    return response