Commits

xu...@xulo-PC  committed 19a8007

support for adding new users without requiring activation email

  • Participants
  • Parent commits fad7080

Comments (0)

Files changed (2)

File registration/backends/default/__init__.py

             site = Site.objects.get_current()
         else:
             site = RequestSite(request)
-        new_user = RegistrationProfile.objects.create_inactive_user(username, email,
-                                                                    password, site)
+        #new_user = RegistrationProfile.objects.create_inactive_user(username, email,
+                                                                    #password, site)
+        new_user = RegistrationProfile.objects.create_active_user(username, email, password, site)
+              
         signals.user_registered.send(sender=self.__class__,
                                      user=new_user,
                                      request=request)

File registration/models.py

         return new_user
     create_inactive_user = transaction.commit_on_success(create_inactive_user)
 
+    def create_active_user(self, username, email, password,
+                             site):
+        """
+        Create a new, active ``User``, generate a
+        ``RegistrationProfile``, so no email is sent.
+        
+        """
+        new_user = User.objects.create_user(username, email, password)
+        new_user.is_active = True
+        new_user.save()
+
+        registration_profile = self.create_profile(new_user)
+
+        return new_user
+    create_active_user = transaction.commit_on_success(create_active_user)
+
     def create_profile(self, user):
         """
         Create a ``RegistrationProfile`` for a given