From cbe48c2db943970501359d61d7557c9fc70e1bf7 Mon Sep 17 00:00:00 2001 From: ngqile Date: Tue, 1 Dec 2026 16:40:50 +0800 Subject: [PATCH] fix: locale-independent code upper-casing; refresh note Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM --- docs/deployment.md | 2 +- .../mobile/api/controller/admin/AdminAuthController.java | 2 +- .../com/solvway/services/system/service/CompanyService.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index c49453d..25ca05d 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -116,7 +116,7 @@ Run both before the new images go live: the new services-counter reads the new ` |---|---| | `openspec/changes/archive/2026-12-01-uppercase-company-codes/sql/01-uppercase-codes.sql` | Turns every company code and every staff login name to capitals (`ins` becomes `INS`, `sales9@cv` becomes `sales9@CV`). Safe to run twice. | -Run it when the new services-system and mobile-api go live. Staff who are signed in must sign in again. Sign-in still ignores case, so staff may keep typing `ins` or `cv`. `99-rollback.sql` in the same folder turns codes and login names back to lowercase. +Run it when the new services-system and mobile-api go live. Staff who are signed in keep working until their session needs a refresh, then sign in again. Sign-in still ignores case, so staff may keep typing `ins` or `cv`. `99-rollback.sql` in the same folder turns codes and login names back to lowercase. **Review the privacy notice before go-live.** The seeded text is a starting template written for the PDPA, not legal advice. INS and CV should each have theirs checked; a super admin changes it under **Companies → Privacy notice**. A company with no notice has no working QR codes. diff --git a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/controller/admin/AdminAuthController.java b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/controller/admin/AdminAuthController.java index 6e657d9..c7b539a 100644 --- a/solvway-mobile-api/src/main/java/com/solvway/mobile/api/controller/admin/AdminAuthController.java +++ b/solvway-mobile-api/src/main/java/com/solvway/mobile/api/controller/admin/AdminAuthController.java @@ -207,7 +207,7 @@ public class AdminAuthController { if (!StringUtils.hasText(username) || username.contains("@")) { return null; } - String code = company == null ? "" : company.trim().toUpperCase(); + String code = company == null ? "" : company.trim().toUpperCase(java.util.Locale.ROOT); return code.isEmpty() ? username.trim() : username.trim() + "@" + code; } } diff --git a/solvway-services-system/src/main/java/com/solvway/services/system/service/CompanyService.java b/solvway-services-system/src/main/java/com/solvway/services/system/service/CompanyService.java index 1dbbb69..6e2b2e3 100644 --- a/solvway-services-system/src/main/java/com/solvway/services/system/service/CompanyService.java +++ b/solvway-services-system/src/main/java/com/solvway/services/system/service/CompanyService.java @@ -97,7 +97,7 @@ public class CompanyService { } private static String validCode(String code) { - String v = code == null ? "" : code.trim().toUpperCase(); + String v = code == null ? "" : code.trim().toUpperCase(java.util.Locale.ROOT); if (!CODE.matcher(v).matches()) throw new IllegalArgumentException("Code must be 2 to 20 characters: A-Z, 0-9 or -"); return v; }