feat(auth): update redirect URLs for login and logout

Configured default redirection to the homepage upon login and logout actions. This improves user experience by ensuring a consistent landing page post-authentication flow.
This commit is contained in:
Kumi 2024-06-23 10:29:14 +02:00
parent 6b78601b3c
commit 05a2de7237
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 3 additions and 1 deletions

View file

@ -10,7 +10,7 @@ urlpatterns = [
SendLoginEmailView.as_view(), SendLoginEmailView.as_view(),
name="login", name="login",
), ),
path("logout/", auth_views.LogoutView.as_view(), name="logout"), path("logout/", auth_views.LogoutView.as_view(next_page="/"), name="logout"),
path( path(
"email-sent/", "email-sent/",
TemplateView.as_view(template_name="accounts/email_sent.html"), TemplateView.as_view(template_name="accounts/email_sent.html"),

View file

@ -109,6 +109,8 @@ else:
AUTH_USER_MODEL = "accounts.CustomUser" AUTH_USER_MODEL = "accounts.CustomUser"
LOGIN_REDIRECT_URL = "/"
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",