damned-lies r1297 - in trunk: . people
- From: claudep svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1297 - in trunk: . people
- Date: Sat, 3 Jan 2009 17:21:21 +0000 (UTC)
Author: claudep
Date: Sat Jan 3 17:21:21 2009
New Revision: 1297
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1297&view=rev
Log:
2009-01-03 Claude Paroz <claude 2xlibre net>
* people/forms.py: Replace sha module by hashlib. Mimic more strict
username choice like admin interface.
Modified:
trunk/ChangeLog
trunk/people/forms.py
Modified: trunk/people/forms.py
==============================================================================
--- trunk/people/forms.py (original)
+++ trunk/people/forms.py Sat Jan 3 17:21:21 2009
@@ -1,4 +1,4 @@
-import sha, random
+import hashlib, random
from django import forms
from django.conf import settings
@@ -16,7 +16,7 @@
class RegistrationForm(forms.Form):
""" Form for user registration """
- username = forms.CharField(max_length=30,
+ username = forms.RegexField(max_length=30, regex=r'^\w+$',
label=ugettext_lazy(u'Choose a username:'),
help_text=ugettext_lazy(u'May contain only letters, numbers, underscores or hyphens'))
email = forms.EmailField(label=ugettext_lazy(u'Email:'))
@@ -60,8 +60,8 @@
openid = self.cleaned_data['openid_url']
if openid:
new_user.openids.create(openid = openid)
- salt = sha.new(str(random.random())).hexdigest()[:5]
- activation_key = sha.new(salt+username).hexdigest()
+ salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
+ activation_key = hashlib.sha1(salt+username).hexdigest()
new_user.activation_key = activation_key
new_user.is_active = False
new_user.save()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]