示例#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
     )