예제 #1
0
 def check_access(cls, request):
     if request.GET.get('data'):
         data = Sign().unsign(request.GET.get('data'), SMS_AGE * 2)
         if data.get('ip') == get_ip(request):
             user_agent = md5(request.META['HTTP_USER_AGENT'])
             if data.get('user_agent') == user_agent:
                 return True
예제 #2
0
 def check_access(cls, request):
     if request.GET.get('data'):
         data = Sign().unsign(request.GET.get('data'), SMS_AGE * 2)
         if data.get('ip') == get_ip(request):
             user_agent = md5(request.META['HTTP_USER_AGENT'])
             if data.get('user_agent') == user_agent:
                 return True
예제 #3
0
 def send_link(cls, request, user):
     data = {
         'ip': get_ip(request),
         'user_agent': md5(request.META.get('HTTP_USER_AGENT')),
     }
     link = 'http://%s%s?data=%s' % (
         Site.objects.get_current(),
         reverse('auth_login'),
         Sign().sign(data)
     )
     send_mail(
         [user.email], _('Link for unlock access'), link
     )
예제 #4
0
 def send_link(cls, request, user):
     data = {
         'ip': get_ip(request),
         'user_agent': md5(request.META.get('HTTP_USER_AGENT')),
     }
     link = 'http://%s%s?data=%s' % (
         Site.objects.get_current(),
         reverse('auth_login'),
         Sign().sign(data)
     )
     send_mail(
         [user.email], _('Link for unlock access'), link
     )