longer emails, longer passwords, longer reset codes

This commit is contained in:
j 2011-10-22 16:38:33 +02:00
commit 15cb3fb5bf
3 changed files with 14 additions and 8 deletions

View file

@ -16,7 +16,7 @@ from itemlist.models import List, Position
class UserProfile(models.Model):
reset_code = models.TextField(blank=True, null=True, unique=True)
reset_code = models.CharField(max_length=255, blank=True, null=True, unique=True)
user = models.ForeignKey(User, unique=True, related_name='profile')
level = models.IntegerField(default=1)

View file

@ -268,7 +268,8 @@ def requestToken(request):
user = None
if user:
while True:
code = ox.to26(random.randint(32768, 1048575))
code = ox.to26(random.randint(ox.from26('BAAAAAAAAAAAAAAA'),
ox.from26('BAAAAAAAAAAAAAAAA')))
if models.UserProfile.objects.filter(reset_code=code).count() == 0:
break
user_profile = user.get_profile()