forked from GithubBackups/healthchecks
Signup form sets the "auto-login" cookie to avoid an extra click during first login
This commit is contained in:
parent
2bb769f7bb
commit
163b020116
@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Upgrade to psycopg2 2.8.3
|
- Upgrade to psycopg2 2.8.3
|
||||||
- Add Go usage example
|
- Add Go usage example
|
||||||
- Send monthly reports on 1st of every month, not randomly during the month
|
- Send monthly reports on 1st of every month, not randomly during the month
|
||||||
|
- Signup form sets the "auto-login" cookie to avoid an extra click during first login
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
- Prevent double-clicking the submit button in signup form
|
- Prevent double-clicking the submit button in signup form
|
||||||
|
@ -26,6 +26,7 @@ class LoginTestCase(BaseTestCase):
|
|||||||
|
|
||||||
r = self.client.post("/accounts/login/?next=/integrations/add_slack/", form)
|
r = self.client.post("/accounts/login/?next=/integrations/add_slack/", form)
|
||||||
self.assertRedirects(r, "/accounts/login_link_sent/")
|
self.assertRedirects(r, "/accounts/login_link_sent/")
|
||||||
|
self.assertIn("auto-login", r.cookies)
|
||||||
|
|
||||||
# The check_token link should have a ?next= query parameter:
|
# The check_token link should have a ?next= query parameter:
|
||||||
self.assertEqual(len(mail.outbox), 1)
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
|
@ -13,6 +13,7 @@ class SignupTestCase(TestCase):
|
|||||||
|
|
||||||
r = self.client.post("/accounts/signup/", form)
|
r = self.client.post("/accounts/signup/", form)
|
||||||
self.assertContains(r, "Account created")
|
self.assertContains(r, "Account created")
|
||||||
|
self.assertIn("auto-login", r.cookies)
|
||||||
|
|
||||||
# An user should have been created
|
# An user should have been created
|
||||||
user = User.objects.get()
|
user = User.objects.get()
|
||||||
|
@ -159,7 +159,11 @@ def signup(request):
|
|||||||
else:
|
else:
|
||||||
ctx = {"form": form}
|
ctx = {"form": form}
|
||||||
|
|
||||||
return render(request, "accounts/signup_result.html", ctx)
|
response = render(request, "accounts/signup_result.html", ctx)
|
||||||
|
if ctx.get("created"):
|
||||||
|
response.set_cookie("auto-login", "1", max_age=300, httponly=True)
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
def login_link_sent(request):
|
def login_link_sent(request):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user