Code formatting

This commit is contained in:
Mira Weller
2025-09-30 15:15:36 +02:00
parent b2a4ba96f8
commit 7333f82e45
4 changed files with 25 additions and 21 deletions
+8 -7
View File
@@ -214,12 +214,14 @@ class PasswordRecoverForm(forms.Form):
error_messages = {
'pw_mismatch': _("Please enter the same password twice"),
}
email = forms.EmailField(max_length=255,
disabled=True,
label=_("Your email address"),
widget=forms.EmailInput(
attrs={'autocomplete': 'username'},
))
email = forms.EmailField(
max_length=255,
disabled=True,
label=_("Your email address"),
widget=forms.EmailInput(
attrs={'autocomplete': 'username'},
),
)
password = forms.CharField(
label=_('Password'),
widget=forms.PasswordInput(attrs={
@@ -325,4 +327,3 @@ class ConfirmationCodeForm(forms.Form):
label='',
widget=forms.NumberInput(attrs={'class': 'confirmation-code-input', 'inputmode': 'numeric', 'type': 'text'}),
)
+6 -8
View File
@@ -40,7 +40,6 @@ from django.contrib.auth.password_validation import (
)
from django.db.models import Q
from django.urls.base import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from pytz import common_timezones
@@ -116,20 +115,20 @@ class UserPasswordChangeForm(forms.Form):
disabled=True,
label=_("Your email address"),
widget=forms.EmailInput(
attrs={'autocomplete': 'username'},
))
attrs={'autocomplete': 'username'},
))
old_pw = forms.CharField(max_length=255,
required=False,
label=_("Your current password"),
widget=forms.PasswordInput(
attrs={'autocomplete': 'current-password'},
))
attrs={'autocomplete': 'current-password'},
))
new_pw = forms.CharField(max_length=255,
required=False,
label=_("New password"),
widget=forms.PasswordInput(
attrs={'autocomplete': 'new-password'},
))
attrs={'autocomplete': 'new-password'},
))
new_pw_repeat = forms.CharField(max_length=255,
required=False,
label=_("Repeat new password"),
@@ -184,7 +183,6 @@ class UserPasswordChangeForm(forms.Form):
)
class UserEmailChangeForm(forms.Form):
error_messages = {
'duplicate_identifier': _("There already is an account associated with this email address. "
+3 -1
View File
@@ -43,7 +43,9 @@ from django.conf import settings
from django.contrib.auth.models import (
AbstractBaseUser, BaseUserManager, PermissionsMixin,
)
from django.contrib.auth.tokens import PasswordResetTokenGenerator, default_token_generator
from django.contrib.auth.tokens import (
PasswordResetTokenGenerator, default_token_generator,
)
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import BadRequest, PermissionDenied
from django.db import IntegrityError, models, transaction
+8 -5
View File
@@ -37,7 +37,6 @@ import json
import logging
import time
from collections import defaultdict
from hmac import compare_digest
from urllib.parse import quote
import webauthn
@@ -61,10 +60,12 @@ from django_otp.plugins.otp_totp.models import TOTPDevice
from django_scopes import scopes_disabled
from webauthn.helpers import generate_challenge, generate_user_handle
from django.core.cache import cache
from pretix.base.auth import get_auth_backends
from pretix.base.forms.auth import ConfirmationCodeForm, ReauthForm
from pretix.base.forms.user import User2FADeviceAddForm, UserEmailChangeForm, UserPasswordChangeForm, UserSettingsForm
from pretix.base.forms.user import (
User2FADeviceAddForm, UserEmailChangeForm, UserPasswordChangeForm,
UserSettingsForm,
)
from pretix.base.models import (
Event, LogEntry, NotificationSetting, U2FDevice, User, WebAuthnDevice,
)
@@ -77,7 +78,6 @@ from pretix.control.permissions import (
from pretix.control.views.auth import get_u2f_appid, get_webauthn_rp_id
from pretix.helpers.http import redirect_to_url
from pretix.helpers.u2f import websafe_encode
from pretix.multidomain.urlreverse import build_absolute_uri
REAL_DEVICE_TYPES = (TOTPDevice, WebAuthnDevice, U2FDevice)
logger = logging.getLogger(__name__)
@@ -906,7 +906,10 @@ class UserEmailConfirmView(FormView):
except PermissionDenied:
return self.form_invalid(form)
except BadRequest:
messages.error(self.request, _('Your email address could not be changed, because we were unable to verify your confirmation code. Please try again.'))
messages.error(self.request, _(
'Your email address could not be changed, because we were unable to '
'verify your confirmation code. Please try again.'
))
return redirect(reverse('control:user.settings', kwargs={}))
msgs = []