Changeset 128:d3572b3e76d1
- Timestamp:
- 04.09.2009 17:16:33 (3 years ago)
- Branch:
- default
- Files:
-
- 1 added
- 63 deleted
- 7 edited
-
apps/captcha/.svn/all-wcprops (deleted)
-
apps/captcha/.svn/entries (deleted)
-
apps/captcha/.svn/format (deleted)
-
apps/captcha/.svn/text-base/__init__.py.svn-base (deleted)
-
apps/captcha/.svn/text-base/fields.py.svn-base (deleted)
-
apps/captcha/.svn/text-base/helpers.py.svn-base (deleted)
-
apps/captcha/.svn/text-base/models.py.svn-base (deleted)
-
apps/captcha/.svn/text-base/urls.py.svn-base (deleted)
-
apps/captcha/.svn/text-base/views.py.svn-base (deleted)
-
apps/captcha/__init__.py (deleted)
-
apps/captcha/conf/.svn/all-wcprops (deleted)
-
apps/captcha/conf/.svn/entries (deleted)
-
apps/captcha/conf/.svn/format (deleted)
-
apps/captcha/conf/.svn/text-base/__init__.py.svn-base (deleted)
-
apps/captcha/conf/.svn/text-base/settings.py.svn-base (deleted)
-
apps/captcha/conf/__init__.py (deleted)
-
apps/captcha/conf/settings.py (deleted)
-
apps/captcha/data/Vera.ttf (deleted)
-
apps/captcha/fields.py (deleted)
-
apps/captcha/fonts/.svn/all-wcprops (deleted)
-
apps/captcha/fonts/.svn/entries (deleted)
-
apps/captcha/fonts/.svn/format (deleted)
-
apps/captcha/fonts/.svn/prop-base/etl-unicode.tar.gz.svn-base (deleted)
-
apps/captcha/fonts/.svn/prop-base/etl14-unicode.pbm.svn-base (deleted)
-
apps/captcha/fonts/.svn/prop-base/etl14-unicode.pil.svn-base (deleted)
-
apps/captcha/fonts/.svn/prop-base/etl16-unicode.pbm.svn-base (deleted)
-
apps/captcha/fonts/.svn/prop-base/etl16-unicode.pil.svn-base (deleted)
-
apps/captcha/fonts/.svn/prop-base/etl24-unicode.pbm.svn-base (deleted)
-
apps/captcha/fonts/.svn/prop-base/etl24-unicode.pil.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl-unicode.tar.gz.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl14-unicode.bdf.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl14-unicode.pbm.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl14-unicode.pil.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl16-unicode.bdf.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl16-unicode.pbm.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl16-unicode.pil.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl24-unicode.bdf.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl24-unicode.pbm.svn-base (deleted)
-
apps/captcha/fonts/.svn/text-base/etl24-unicode.pil.svn-base (deleted)
-
apps/captcha/fonts/etl-unicode.tar.gz (deleted)
-
apps/captcha/fonts/etl14-unicode.bdf (deleted)
-
apps/captcha/fonts/etl14-unicode.pbm (deleted)
-
apps/captcha/fonts/etl14-unicode.pil (deleted)
-
apps/captcha/fonts/etl16-unicode.bdf (deleted)
-
apps/captcha/fonts/etl16-unicode.pbm (deleted)
-
apps/captcha/fonts/etl16-unicode.pil (deleted)
-
apps/captcha/fonts/etl24-unicode.bdf (deleted)
-
apps/captcha/fonts/etl24-unicode.pbm (deleted)
-
apps/captcha/fonts/etl24-unicode.pil (deleted)
-
apps/captcha/helpers.py (deleted)
-
apps/captcha/models.py (deleted)
-
apps/captcha/tests/.svn/all-wcprops (deleted)
-
apps/captcha/tests/.svn/entries (deleted)
-
apps/captcha/tests/.svn/format (deleted)
-
apps/captcha/tests/.svn/text-base/__init__.py.svn-base (deleted)
-
apps/captcha/tests/.svn/text-base/urls.py.svn-base (deleted)
-
apps/captcha/tests/.svn/text-base/views.py.svn-base (deleted)
-
apps/captcha/tests/__init__.py (deleted)
-
apps/captcha/tests/urls.py (deleted)
-
apps/captcha/tests/views.py (deleted)
-
apps/captcha/urls.py (deleted)
-
apps/captcha/util.py (deleted)
-
apps/captcha/views.py (deleted)
-
apps/forum/forms.py (modified) (3 diffs)
-
apps/forum/urls.py (modified) (3 diffs)
-
apps/forum/views.py (modified) (1 diff)
-
settings.py (modified) (2 diffs)
-
static/forum/img/openid_logo.png (added)
-
templates/openauth/openid_registration.html (modified) (1 diff)
-
templates/openauth/registration.html (modified) (4 diffs)
-
templates/openauth/reset_password.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
apps/forum/forms.py
r115 r128 14 14 from forum.markups import mypostmarkup 15 15 from forum import settings as forum_settings 16 from openauth.forms import RegistrationForm 16 import openauth 17 from openauth.forms import RegistrationForm, OpenIDRegistrationForm 18 from openauth.models import OpenID 17 19 from annoying.functions import get_object_or_None 18 20 … … 396 398 ) 397 399 super(RegistrationForm, self).__init__(*args, **kwargs) 398 if ACCOUNT_CAPTCHA: 399 self.fields['captcha'] = CaptchaField() 400 401 400 402 401 def clean_email(self): 403 if get_object_or_None(User, email=self.cleaned_data[' login'].lower()):402 if get_object_or_None(User, email=self.cleaned_data['email'].lower()): 404 403 raise forms.ValidationError(_(u'This email already registered')) 405 406 404 407 405 def save(self): 408 406 username = self.cleaned_data['login'] … … 420 418 profile.save() 421 419 return user 420 421 422 class CustomOpenIDRegistrationForm(OpenIDRegistrationForm): 423 username = forms.CharField() 424 email = forms.EmailField() 425 426 def clean_email(self): 427 if get_object_or_None(User, email=self.cleaned_data['email'].lower()): 428 raise forms.ValidationError(_(u'This email already registered')) 429 return self.cleaned_data['email'] 430 431 def clean_username(self): 432 if get_object_or_None(User, username__iexact=self.cleaned_data['username']): 433 raise forms.ValidationError(_(u'This username is already taken')) 434 return self.cleaned_data['username'] 435 436 def save(self, openid_url): 437 username = self.cleaned_data['username'] 438 email = self.cleaned_data['email'] 439 user = User.objects.create(username=username, email=email) 440 if openauth.settings.OPENID_ACTIVATION_REQUIRED: 441 user.is_active = False 442 user.save() 443 OpenID(user=user, url=openid_url).save() 444 return user -
apps/forum/urls.py
r115 r128 7 7 urlpatterns = patterns('', 8 8 # Account 9 url(r'^registration/$', openauth_views.registration, name='openauth-registration'), 10 url(r'^login/$', openauth_views.login, name='openauth-login'), 11 url(r'^openid-login/$', openauth_views.openid_login, name='openauth-openid-login'), 12 #url(r'^openid-complete/$', openauth_views.openid_complete, name='openauth-openid-complete'), 13 #url(r'^openid-registration/$', openauth_views.openid_registration, name='openauth-openid-registration'), 14 url(r'^logout/$', openauth_views.logout, name='openauth-logout'), 15 url(r'^reset-password/$', openauth_views.reset_password, name='openauth-reset-password'), 16 url(r'^change-password/$', openauth_views.change_password, name='openauth-change-password'), 17 18 # Captcha 19 (r'^', include('captcha.urls')), 20 9 url(r'^auth/registration/$', openauth_views.registration, name='openauth-registration'), 10 url(r'^auth/login/$', openauth_views.login, name='openauth-login'), 11 url(r'^auth/openid-login/$', openauth_views.openid_login, name='openauth-openid-login'), 12 url(r'^auth/openid-complete/$', openauth_views.openid_complete, name='openauth-openid-complete'), 13 url(r'^auth/openid-registration/$', openauth_views.openid_registration, name='openauth-openid-registration'), 14 url(r'^auth/logout/$', openauth_views.logout, name='openauth-logout'), 15 url(r'^auth/reset-password/$', openauth_views.reset_password, name='openauth-reset-password'), 16 url(r'^auth/change-password/$', openauth_views.change_password, name='openauth-change-password'), 17 #(r'', include('confirmation.urls'))# needed for activation 18 21 19 # Misc 22 20 url('^$', forum_views.index, name='index'), … … 25 23 url('^search/$', forum_views.search, name='search'), 26 24 url('^misc/$', forum_views.misc, name='misc'), 27 25 28 26 # User 29 27 url('^user/(?P<username>.*)/$', forum_views.user, name='forum_profile'), … … 80 78 url('^reputation/(?P<username>.*)/$', forum_views.reputation, name='reputation'), 81 79 ) 82 80 83 81 # ATTACHMENT Extension 84 82 if (forum_settings.ATTACHMENT_SUPPORT): -
apps/forum/views.py
r127 r128 360 360 return {'categories': Category.objects.all(), 361 361 'topic': topic, 362 #'last_post': last_post,363 #'form': form,364 #'moderator': moderator,365 #'subscribed': subscribed,366 #'paged_qs': posts,367 362 'pages': pages, 368 363 'paginator': paginator, -
settings.py
r118 r128 116 116 'django.contrib.admin', 117 117 'django.contrib.admindocs', 118 'notify', 119 'confirmation', 118 120 'openauth', 119 'captcha',120 121 'forum', 121 122 'djapian', … … 138 139 # Account settings 139 140 REGISTRATION_FORM = 'forum.forms.CustomRegistrationForm' 140 ACCOUNT_CAPTCHA = True 141 OPENID_REGISTRATION_FORM = 'forum.forms.CustomOpenIDRegistrationForm' 141 142 LOGIN_REDIRECT_URL = '/forum/' 142 143 LOGOUT_REDIRECT_URL = '/forum/' 143 144 NOTIFY_TYPE = 'flashcookie' 145 OPENID_EXTRA_FIELDS = ['nickname', 'email'] 146 OPENID_PROFILE_MAPPING = {'nickname': 'login', 'email': 'email'} 147 144 148 145 149 try: -
templates/openauth/openid_registration.html
r115 r128 1 {% extends ' base.html' %}1 {% extends 'forum/base.html' %} 2 2 {% load i18n %} 3 3 4 4 {% block content %} 5 <h2>{% trans "Registration with OpenID: last step" %}</h2> 6 <p><label>{% trans "OpenID URL" %}:</label> {{ openid_url }}</p> 7 <form method="post"> 8 <formfield> 9 <legend>Регистрация через OpenID</legend> 10 <div class="wide">{{ form.as_p }}</div> 11 <p><input type="submit" value="{% trans "Submit" %}"/></p> 12 </formfield> 13 </form> 5 <div class="blockform"> 6 <h2><span>{% trans "Registration with OpenID: last step" %}</span></h2> 7 <div class="box"> 8 <form method="post"> 9 <div class="inform"> 10 <fieldset> 11 <legend>{% trans "Registration with OpenID" %}</legend> 12 <div class="infldset"> 13 <div class="inform">{{ form.as_p }}</div> 14 <p>{% trans "OpenID URL" %}: {{ openid_url }}</p> 15 </div> 16 <p><input type="submit" value="{% trans "Submit" %}"/></p> 17 </fieldset> 18 </div> 19 </form> 20 </div> 21 </div> 14 22 {% endblock %} -
templates/openauth/registration.html
r115 r128 22 22 </fieldset> 23 23 </div> 24 25 24 <div class="inform"> 26 25 <fieldset> … … 30 29 <label class="conl"><strong>{{ form.password_dup.label }}</strong><br />{{ form.password_dup }}<br /></label> 31 30 <p class="clearb">{% blocktrans %}Passwords are case sensitive.{% endblocktrans %}</p> 32 33 31 </div> 34 32 </fieldset> 35 33 </div> 36 37 <div class="inform">38 <fieldset>39 <legend>{% trans "Image Verification" %}</legend>40 <div class="infldset">41 {{ form.captcha }}42 <p class="clearb">{% trans "Please enter 4 letters or digits that appear in the image opposite" %}</p>43 44 </div>45 </fieldset>46 </div>47 48 34 <div class="inform"> 49 35 <fieldset> … … 67 53 </div> 68 54 <div class="inform"> 69 70 55 <fieldset> 71 56 <legend>{% trans "Set your privacy options" %}</legend> … … 76 61 </div> 77 62 </div> 78 79 63 </fieldset> 80 64 </div> -
templates/openauth/reset_password.html
r115 r128 10 10 <fieldset> 11 11 <legend>{% trans "Enter the e-mail address with which you registered" %}</legend> 12 13 12 <div class="infldset"> 14 13 {{ form.email }}
Note: See TracChangeset
for help on using the changeset viewer.
