fix(gerp/mail): 邮箱名统一小写化,与 Stalwart 规范化存储保持一致
This commit is contained in:
1 parent
9d9102617f
commit
bae47dae8c
1 file changed
+4
-2
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user