From 2d5e7bfa5e50fe55248d425bb05a2abb0d449010 Mon Sep 17 00:00:00 2001 From: JamieGunnCO Date: Tue, 30 Apr 2024 12:35:52 +0100 Subject: [PATCH] convert admin email to lowercase before validation --- .../gap/adminbackend/controllers/UserController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/UserController.java b/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/UserController.java index d70e5d1b..f6518700 100644 --- a/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/UserController.java +++ b/src/main/java/gov/cabinetoffice/gap/adminbackend/controllers/UserController.java @@ -160,7 +160,8 @@ public ResponseEntity updateFundingOrganisation(@RequestBody UpdateFundi @PreAuthorize("hasRole('SUPER_ADMIN')") public ResponseEntity checkNewAdminEmailIsValid( @RequestBody @Valid final CheckNewAdminEmailDto checkNewAdminEmailDto, final HttpServletRequest request) { - if (checkNewAdminEmailDto.getEmailAddress().equals(checkNewAdminEmailDto.getOldEmailAddress())) { + // the email we store comes from One Login, which will always convert the value the user entered to lowercase + if (checkNewAdminEmailDto.getEmailAddress().toLowerCase().equals(checkNewAdminEmailDto.getOldEmailAddress())) { throw new FieldViolationException("emailAddress", "This user already owns this grant."); }