From 13cbe7b6b94022ab9c10bd5ed11deadfd6db9d8a Mon Sep 17 00:00:00 2001 From: Rolf Erik Lekang Date: Sun, 24 Feb 2013 15:52:13 +0100 Subject: [PATCH] fix typo in code max_length --- django_nopassword/models.py | 3 ++- setup.py | 2 +- tests/tests.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/django_nopassword/models.py b/django_nopassword/models.py index 8118ec7..bbdb69a 100644 --- a/django_nopassword/models.py +++ b/django_nopassword/models.py @@ -2,6 +2,7 @@ import string from random import choice from datetime import datetime + from django.conf import settings from django.core.mail import send_mail from django.core.urlresolvers import reverse @@ -12,7 +13,7 @@ class LoginCode(models.Model): user = models.ForeignKey(User, related_name='login_codes', editable=False, verbose_name=_('user')) - code = models.CharField(max_length=2, editable=False, verbose_name=_('code')) + code = models.CharField(max_length=20, editable=False, verbose_name=_('code')) timestamp = models.DateTimeField(editable=False) next = models.TextField(editable=False, blank=True) diff --git a/setup.py b/setup.py index e89fce6..94e368c 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name = "django-nopassword", - version = '0.1.1', + version = '0.1.2', url='http://github.com/relekang/django-nopassword', author = 'Rolf Erik Lekang', author_email = 'me@rolflekang.com', diff --git a/tests/tests.py b/tests/tests.py index e7a49b0..c0f7dc1 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -2,6 +2,7 @@ from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.utils import unittest + from django_nopassword.models import LoginCode @@ -11,7 +12,7 @@ def setUp(self): def test_login_backend(self): self.code = LoginCode.create_code_for_user(self.user) - self.assertIsNotNone(self.code.pk) + self.assertEqual(len(self.code.code), 20) self.assertIsNotNone(authenticate(username=self.user.username, code=self.code.code)) self.assertEqual(LoginCode.objects.filter(user=self.user, code=self.code.code).count(), 0)