Skip to content

Commit 8212c20

Browse files
committed
remove autofocus on password change form
1 parent 17cc2b0 commit 8212c20

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/app/forms.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django import forms
22
from .models import User
3-
from django.contrib.auth.forms import UserCreationForm
3+
from django.contrib.auth.forms import UserCreationForm, PasswordChangeForm
44

55

66
class UserRegisterForm(UserCreationForm):
@@ -25,3 +25,9 @@ class UserUpdateForm(forms.ModelForm):
2525
class Meta:
2626
model = User
2727
fields = ["username", "default_api"]
28+
29+
30+
class PasswordChangeForm(PasswordChangeForm):
31+
def __init__(self, *args, **kwargs):
32+
super().__init__(*args, **kwargs)
33+
self.fields['old_password'].widget.attrs.pop("autofocus", None)

src/app/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
authenticate,
66
login as auth_login,
77
)
8-
from django.contrib.auth.forms import PasswordChangeForm, AuthenticationForm
8+
from django.contrib.auth.forms import AuthenticationForm
99
from django.contrib.auth.decorators import login_required
1010
from django.utils.http import url_has_allowed_host_and_scheme
1111
from django.http import JsonResponse
@@ -14,7 +14,7 @@
1414

1515

1616
from app.models import Media, Season
17-
from app.forms import UserRegisterForm, UserUpdateForm
17+
from app.forms import UserRegisterForm, UserUpdateForm, PasswordChangeForm
1818
from app.utils import database, interactions, imports
1919

2020

0 commit comments

Comments
 (0)