custom reset form

This commit is contained in:
Matthias 2021-10-07 15:08:08 +02:00
parent f89dd84daf
commit 8ef07dcf61
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 11 additions and 2 deletions

View File

@ -13,7 +13,7 @@ from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field
from crispy_forms.bootstrap import PrependedText, AppendedText, PrependedAppendedText, StrictButton, Div
from allauth.account.forms import SignupForm, set_form_field_order
from allauth.account.forms import SignupForm, ResetPasswordForm, set_form_field_order
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
@ -252,6 +252,15 @@ class CustomSignupForm(SignupForm):
return cleaned_data
class CustomResetPasswordForm(ResetPasswordForm):
"""
Override to use dynamic settings
"""
def save(self):
email_address = super().save()
return email_address
class RegistratonMixin:
"""
Mixin to check if registration should be enabled

View File

@ -676,7 +676,7 @@ ACCOUNT_FORMS = {
'add_email': 'allauth.account.forms.AddEmailForm',
'change_password': 'allauth.account.forms.ChangePasswordForm',
'set_password': 'allauth.account.forms.SetPasswordForm',
'reset_password': 'allauth.account.forms.ResetPasswordForm',
'reset_password': 'InvenTree.forms.CustomResetPasswordForm',
'reset_password_from_key': 'allauth.account.forms.ResetPasswordKeyForm',
'disconnect': 'allauth.socialaccount.forms.DisconnectForm',
}