perf: delete_test_cookie

pull/5834/head
xinwen 4 years ago committed by 老广
parent 370e1628be
commit 2562386fe0

@ -55,6 +55,9 @@ class UserLoginView(mixins.AuthMixin, FormView):
def form_valid(self, form): def form_valid(self, form):
if not self.request.session.test_cookie_worked(): if not self.request.session.test_cookie_worked():
return HttpResponse(_("Please enable cookies and try again.")) return HttpResponse(_("Please enable cookies and try again."))
# https://docs.djangoproject.com/en/3.1/topics/http/sessions/#setting-test-cookies
self.request.session.delete_test_cookie()
try: try:
self.check_user_auth(decrypt_passwd=True) self.check_user_auth(decrypt_passwd=True)
except errors.AuthFailedError as e: except errors.AuthFailedError as e:

Loading…
Cancel
Save