- def clean(self):
- username = self.cleaned_data.get('username')
- password = self.cleaned_data.get('password')
- user = authenticate(username=username, password=password)
- if user is None:
- raise ValidationError(_('Incorrect username and/or password.'))
- if not user.is_active:
- raise ValidationError(_('This account is disabled.'))
- self._user = user
- self.cleaned_data.get('lt').delete()
- return self.cleaned_data
+ def clean_remember_me(self):
+ remember = self.cleaned_data['remember_me']
+ if not remember and self.request is not None:
+ self.request.session.set_expiry(0)
+