From 187da91c915835ce588d4976798e410b4332b62e Mon Sep 17 00:00:00 2001 From: Kara Engelhardt Date: Fri, 24 Jul 2026 18:14:42 +0200 Subject: [PATCH] Show new login time in users timezone (Z#23241469) --- src/pretix/helpers/security.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pretix/helpers/security.py b/src/pretix/helpers/security.py index 847aed36d6..2e2e6dce51 100644 --- a/src/pretix/helpers/security.py +++ b/src/pretix/helpers/security.py @@ -28,7 +28,7 @@ from django.contrib.auth import login as auth_login from django.contrib.gis import geoip2 from django.core.cache import cache from django.utils.formats import date_format -from django.utils.timezone import now +from django.utils.timezone import now, override, localtime from django.utils.translation import gettext_lazy as _ from django_countries.fields import Country from geoip2.errors import AddressNotFoundError @@ -167,13 +167,13 @@ def handle_login_source(user, request): }) if user.known_login_sources.count() > 1: # Do not send on first login or first login after introduction of this feature: - with language(user.locale): + with language(user.locale), override(user.timezone): mail( user.email, _('New sign-in to your account'), 'pretixcontrol/email/login_notice.txt', { - 'when': date_format(src.last_seen, 'DATETIME_FORMAT'), + 'when': date_format(localtime(src.last_seen), 'DATETIME_FORMAT'), 'agent': src.agent_type, 'os': src.os_type, # ua-parser returns "Other" for unidentified desktop devices.