diff gpp/accounts/views.py @ 347:69d0306a6fe7

Fixing #165: add a way to filter users in the admin by join date; add an admin action to approve a pending user; added a honeypot type field to the registration form.
author Brian Neal <bgneal@gmail.com>
date Wed, 02 Mar 2011 01:11:32 +0000
parents 767cedc7d12a
children 7c3816d76c6c
line wrap: on
line diff
--- a/gpp/accounts/views.py	Mon Feb 28 03:53:04 2011 +0000
+++ b/gpp/accounts/views.py	Wed Mar 02 01:11:32 2011 +0000
@@ -12,6 +12,7 @@
 
 from accounts.models import PendingUser
 from accounts.forms import RegisterForm
+from accounts import create_new_user
 
 
 #######################################################################
@@ -69,23 +70,8 @@
             },
             context_instance = RequestContext(request))
 
-    new_user = User()
+    create_new_user(pending_user, ip)
 
-    new_user.username = pending_user.username
-    new_user.first_name = ''
-    new_user.last_name = ''
-    new_user.email = pending_user.email
-    new_user.password = pending_user.password     # already been hashed
-    new_user.is_staff = False
-    new_user.is_active = True
-    new_user.is_superuser = False
-    new_user.last_login = datetime.datetime.now()
-    new_user.date_joined = new_user.last_login
-
-    new_user.save()
-    pending_user.delete()
-
-    logging.info('Accounts register_confirm [%s]: success: %s', ip, username)
     return render_to_response('accounts/register_success.html', {
         'username': username,
         },