Exemplo n.º 1
0
 def set_email(self, new_email):
     self.email = UserManager.normalize_email(new_email)
     self.email_hash = hash_email(new_email)
Exemplo n.º 2
0
 def get_by_email(self, email):
     return self.get(email_hash=hash_email(email))
Exemplo n.º 3
0
 def get_by_username_or_email(self, login):
     queryset = models.Q(slug=slugify(login))
     queryset = queryset | models.Q(email_hash=hash_email(login))
     return self.get(queryset)
Exemplo n.º 4
0
 def get_by_username_or_email(self, login):
     queryset = models.Q(slug=slugify(login))
     queryset = queryset | models.Q(email_hash=hash_email(login))
     return self.get(queryset)
Exemplo n.º 5
0
 def set_email(self, new_email):
     self.email = UserManager.normalize_email(new_email)
     self.email_hash = hash_email(new_email)
 def test_is_case_insensitive(self):
     """util is case insensitive"""
     self.assertEqual(hash_email('*****@*****.**'), hash_email('*****@*****.**'))
Exemplo n.º 7
0
 def get_by_email(self, email):
     return self.get(email_hash=hash_email(email))
 def test_handles_unicode(self):
     """util works with unicode strings"""
     self.assertEqual(hash_email(u'łóć@test.com'), hash_email(u'ŁÓĆ@tEst.cOm'))
Exemplo n.º 9
0
 def test_is_case_insensitive(self):
     """util is case insensitive"""
     self.assertEqual(hash_email('*****@*****.**'),
                      hash_email('*****@*****.**'))
Exemplo n.º 10
0
 def test_handles_unicode(self):
     """util works with unicode strings"""
     self.assertEqual(hash_email('łóć@test.com'),
                      hash_email('ŁÓĆ@tEst.cOm'))
Exemplo n.º 11
0
 def get_by_username_or_email(self, login):
     if '@' in login:
         return self.get(email_hash=hash_email(login))
     return self.get(slug=slugify(login))
Exemplo n.º 12
0
 def test_hash_email_works(self):
     """hash email produces repeatable outcomes"""
     self.assertEqual(hash_email('*****@*****.**'),
                      hash_email('*****@*****.**'))