diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-03-27 16:06:23 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-03-27 16:07:39 -0400 |
commit | acd9aeca8e697b6d1f8f7ac29d7e3afac07b2e8a (patch) | |
tree | dbb232a017f71934cfb05b264db0cca40ac00164 /forum_modules/localauth/forms.py | |
parent | 40ea3f482ffdfd648366ed20a87335dc31e92231 (diff) | |
download | askbot-acd9aeca8e697b6d1f8f7ac29d7e3afac07b2e8a.tar.gz askbot-acd9aeca8e697b6d1f8f7ac29d7e3afac07b2e8a.tar.bz2 askbot-acd9aeca8e697b6d1f8f7ac29d7e3afac07b2e8a.zip |
removed authentication module to be replaced with a dedicated app, also switched to table layout for openid signin template temporarily so that it works on IE7 and maybe earlier
Diffstat (limited to 'forum_modules/localauth/forms.py')
-rwxr-xr-x | forum_modules/localauth/forms.py | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/forum_modules/localauth/forms.py b/forum_modules/localauth/forms.py deleted file mode 100755 index 8afa2b05..00000000 --- a/forum_modules/localauth/forms.py +++ /dev/null @@ -1,77 +0,0 @@ -from forum.utils.forms import NextUrlField, UserNameField, UserEmailField, SetPasswordForm -from forum.models import EmailFeedSetting, Question -from django.contrib.contenttypes.models import ContentType -from django.utils.translation import ugettext as _ -from django.contrib.auth import authenticate -from django import forms -import logging - -class ClassicRegisterForm(SetPasswordForm): - """ legacy registration form """ - - next = NextUrlField() - username = UserNameField() - email = UserEmailField() - #fields password1 and password2 are inherited - #recaptcha = ReCaptchaField() - -class ClassicLoginForm(forms.Form): - """ legacy account signin form """ - next = NextUrlField() - username = UserNameField(required=False,skip_clean=True) - password = forms.CharField(max_length=128, - widget=forms.widgets.PasswordInput(attrs={'class':'required login'}), - required=False) - - def __init__(self, data=None, files=None, auto_id='id_%s', - prefix=None, initial=None): - super(ClassicLoginForm, self).__init__(data, files, auto_id, - prefix, initial) - self.user_cache = None - - def _clean_nonempty_field(self,field): - value = None - if field in self.cleaned_data: - value = str(self.cleaned_data[field]).strip() - if value == '': - value = None - self.cleaned_data[field] = value - return value - - def clean_username(self): - return self._clean_nonempty_field('username') - - def clean_password(self): - return self._clean_nonempty_field('password') - - def clean(self): - error_list = [] - username = self.cleaned_data['username'] - password = self.cleaned_data['password'] - - self.user_cache = None - if username and password: - self.user_cache = authenticate(username=username, password=password) - - if self.user_cache is None: - del self.cleaned_data['username'] - del self.cleaned_data['password'] - error_list.insert(0,(_("Please enter valid username and password " - "(both are case-sensitive)."))) - elif self.user_cache.is_active == False: - error_list.append(_("This account is inactive.")) - if len(error_list) > 0: - error_list.insert(0,_('Login failed.')) - elif password == None and username == None: - error_list.append(_('Please enter username and password')) - elif password == None: - error_list.append(_('Please enter your password')) - elif username == None: - error_list.append(_('Please enter user name')) - if len(error_list) > 0: - self._errors['__all__'] = forms.util.ErrorList(error_list) - return self.cleaned_data - - def get_user(self): - """ get authenticated user """ - return self.user_cache
\ No newline at end of file |