Anonymous avatar Anonymous committed 5a8daa4

Activation changes

Comments (0)

Files changed (3)

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

registration/backends/default/__init__.py

         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', (), {})

registration/models.py

 
 
 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,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.