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."); }