1. Anton Baterikov
  2. django-registration

Commits

anto...@btn-mac.local  committed 5a8daa4

Activation changes

  • Participants
  • Parent commits 3e9cfc2
  • Branches default

Comments (0)

Files changed (3)

File .hgtags

View file
 e263c551ef7be3d99813effdc7a4f22041539f83 v0.6
 d073602dc103edfae55419b043af1f4b6a58e1e5 v0.7
 2d6fcc0c55d0c63d5e506b59e32cad9329963509 v0.8
+

File registration/backends/default/__init__.py

View file
         user registration.
         
         """
-        return ('registration_complete', (), {})
+        return ('accounts:registration_complete', (), {})
 
     def post_activation_redirect(self, request, user):
         """
         account activation.
         
         """
-        return ('registration_activation_complete', (), {})
+        return ('accounts:registration_activation_complete', (), {})

File registration/models.py

View file
 
 
 SHA1_RE = re.compile('^[a-f0-9]{40}$')
-MOBILE_CODE_RE = re.compile('^\d{8}$')
 
 
 class RegistrationManager(models.Manager):
         return False
 
     def activate_user_by_mobile_code(self, mobile_code):
-        if SHA1_RE.search(mobile_code):
-            try:
-                profile = self.get(mobile_code=mobile_code)
-            except self.model.DoesNotExist:
-                return False
-            if not profile.activation_key_expired():
-                user = profile.user
-                user.is_active = True
-                user.save()
-                profile.activation_key = self.model.ACTIVATED
-                profile.save()
-                return user
+        try:
+            profile = self.get(mobile_code=mobile_code)
+        except self.model.DoesNotExist:
+            return False
+        if not profile.activation_key_expired():
+            user = profile.user
+            user.is_active = True
+            user.save()
+            profile.activation_key = self.model.ACTIVATED
+            profile.save()
+            return user
         return False
     
     def create_inactive_user(self, username, email, password,