Skip to content

Commit 3adb655

Browse files
committed
fix: Resolve compatibility issue between AuthenticationForm and allauth LoginView
- Use custom allauth LoginForm instead of AuthenticationForm
1 parent 2d1122f commit 3adb655

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

base/forms.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from allauth.account.forms import LoginForm
2+
3+
4+
class DjangoSnippetsLoginForm(LoginForm):
5+
6+
def _setup_password_field(self):
7+
super()._setup_password_field()
8+
# Disable allauth's automatically set help_text
9+
self.fields["password"].help_text = None

djangosnippets/settings/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ def user_url(user):
144144
ACCOUNT_LOGOUT_ON_GET = True
145145
ACCOUNT_USERNAME_MIN_LENGTH = 3
146146
ACCOUNT_FORMS = {
147-
"login": "django.contrib.auth.forms.AuthenticationForm",
147+
"login": "base.forms.DjangoSnippetsLoginForm",
148148
}
149+
ACCOUNT_SESSION_REMEMBER = True
149150
SOCIALACCOUNT_ADAPTER = "djangosnippets.adapters.DjangoSnippetsSocialAccountAdapter"
150151
SOCIALACCOUNT_AUTO_SIGNUP = False
151152
SOCIALACCOUNT_LOGIN_ON_GET = True

0 commit comments

Comments
 (0)