Mercurial > public > sg101
comparison 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 |
comparison
equal
deleted
inserted
replaced
346:efa3b4901777 | 347:69d0306a6fe7 |
---|---|
10 from django.core.urlresolvers import reverse | 10 from django.core.urlresolvers import reverse |
11 from django.conf import settings | 11 from django.conf import settings |
12 | 12 |
13 from accounts.models import PendingUser | 13 from accounts.models import PendingUser |
14 from accounts.forms import RegisterForm | 14 from accounts.forms import RegisterForm |
15 from accounts import create_new_user | |
15 | 16 |
16 | 17 |
17 ####################################################################### | 18 ####################################################################### |
18 | 19 |
19 def register(request): | 20 def register(request): |
67 return render_to_response('accounts/register_failure.html', { | 68 return render_to_response('accounts/register_failure.html', { |
68 'username': username, | 69 'username': username, |
69 }, | 70 }, |
70 context_instance = RequestContext(request)) | 71 context_instance = RequestContext(request)) |
71 | 72 |
72 new_user = User() | 73 create_new_user(pending_user, ip) |
73 | 74 |
74 new_user.username = pending_user.username | |
75 new_user.first_name = '' | |
76 new_user.last_name = '' | |
77 new_user.email = pending_user.email | |
78 new_user.password = pending_user.password # already been hashed | |
79 new_user.is_staff = False | |
80 new_user.is_active = True | |
81 new_user.is_superuser = False | |
82 new_user.last_login = datetime.datetime.now() | |
83 new_user.date_joined = new_user.last_login | |
84 | |
85 new_user.save() | |
86 pending_user.delete() | |
87 | |
88 logging.info('Accounts register_confirm [%s]: success: %s', ip, username) | |
89 return render_to_response('accounts/register_success.html', { | 75 return render_to_response('accounts/register_success.html', { |
90 'username': username, | 76 'username': username, |
91 }, | 77 }, |
92 context_instance = RequestContext(request)) | 78 context_instance = RequestContext(request)) |