This is my urls.py:
from django.urls import path, reverse_lazy
from django.contrib.auth import views as auth_views
from .forms import EmailValidationOnForgotPassword
from . import views
app_name = 'account'
urlpatterns = [
path('', views.dashboard, name='dashboard'),
path('login/', auth_views.LoginView.as_view(), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
path('password_change/', auth_views.PasswordChangeView.as_view(success_url=reverse_lazy('account:password_change_done')), name='password_change'),
path('password_change/done', auth_views.PasswordChangeDoneView.as_view(), name='password_change_done'),
path('password_reset/', auth_views.PasswordResetView.as_view(form_class=EmailValidationOnForgotPassword, success_url=reverse_lazy('account:password_reset_done')), name='password_reset'),
path('password_reset/done', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset/<uidb64>/<token>', auth_views.PasswordResetConfirmView.as_view(success_url=reverse_lazy('account:password_reset_complete')), name='password_reset_confirm'),
path('reset/done', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
]
Is there any attributes i can use like 'success_url' or 'form_class'
To override LoginView you need to change the
path('login/', auth_views.LoginView.as_view(), name='login'),
to:
path('login/', views.myCustomLoginView, name='login'),
Then create a myCustomLoginView
method in the views.py
with the desired modifications. Naturally it must be followed by the appropriate custom login_template.html