From bae47dae8c879f4f2cd6b2f9667394ebba46930d Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 13 Aug 2026 01:06:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(gerp/mail):=20=E9=82=AE=E7=AE=B1=E5=90=8D?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=B0=8F=E5=86=99=E5=8C=96=EF=BC=8C=E4=B8=8E?= =?UTF-8?q?=20Stalwart=20=E8=A7=84=E8=8C=83=E5=8C=96=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gvsds/apps/gerp/views/mail.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gvsds/apps/gerp/views/mail.py b/gvsds/apps/gerp/views/mail.py index eadd5cbf..f7cc621a 100644 --- a/gvsds/apps/gerp/views/mail.py +++ b/gvsds/apps/gerp/views/mail.py @@ -230,6 +230,8 @@ class MailApplyView(ELTAuthenticatedAPIView): return Response({'code': 1, 'msg': '邮箱名需为字母/数字/点/下划线/连字符,长度 3~63'}, status=400) if not _PASSWORD_RE.match(password): return Response({'code': 1, 'msg': '密码需 8~64 位且同时包含字母和数字'}, status=400) + # 统一小写:Stalwart 按小写规范化存储 principal,DB 记录必须与之一致,避免大小写变体重复/错配 + mailbox_name = mailbox_name.lower() try: quota_mb = int(request.data.get('QuotaMB') or 1024) @@ -293,7 +295,7 @@ class MailChangePasswordView(ELTAuthenticatedAPIView): permission_classes = [IsAuthenticated] def post(self, request): - mailbox_name = (request.data.get('MailboxName') or '').strip() + mailbox_name = (request.data.get('MailboxName') or '').strip().lower() queryset = UserMailbox.objects.filter(UserUUID=request.user, Status=1) mailbox = queryset.filter(MailboxName=mailbox_name).first() if mailbox_name else queryset.first() if mailbox is None: @@ -410,7 +412,7 @@ class MailLoginView(ELTAuthenticatedAPIView): permission_classes = [IsAuthenticated] def post(self, request): - mailbox_name = (request.data.get('MailboxName') or '').strip() + mailbox_name = (request.data.get('MailboxName') or '').strip().lower() queryset = UserMailbox.objects.filter(UserUUID=request.user, Status=1) mailbox = queryset.filter(MailboxName=mailbox_name).first() if mailbox_name else queryset.first() if mailbox is None: