Changes between Version 4 and Version 5 of CookBookDualSessionMiddleware
- Timestamp:
- Jul 26, 2007, 7:33:52 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBookDualSessionMiddleware
v4 v5 92 92 form = LoginForm(request.POST) 93 93 if form.is_valid(): 94 user = auth.authenticate(username = form.clean _data['username'],95 password = form.clean _data['password'])94 user = auth.authenticate(username = form.cleaned_data['username'], 95 password = form.cleaned_data['password']) 96 96 if user: 97 97 if user.is_active: 98 98 auth.login(request, user) 99 request.session[settings.PERSISTENT_SESSION_KEY] = form.clean _data['remember_user']99 request.session[settings.PERSISTENT_SESSION_KEY] = form.cleaned_data['remember_user'] 100 100 # login successful, redirect 101 101 return HttpResponseRedirect('/') … … 144 144 def clean(self): 145 145 try: 146 user = User.objects.get(username__iexact = self.clean _data['username'])146 user = User.objects.get(username__iexact = self.cleaned_data['username']) 147 147 except User.DoesNotExist, KeyError: 148 148 raise forms.ValidationError('Invalid username, please try again.') 149 149 150 if not user.check_password(self.clean _data['password']):150 if not user.check_password(self.cleaned_data['password']): 151 151 raise forms.ValidationError('Invalid password, please try again.') 152 152 153 return self.clean _data153 return self.cleaned_data 154 154 }}} 155 155