Skip to content

Commit

Permalink
Merge branch 'develop' into release/11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jgunnCO committed Apr 30, 2024
2 parents f057aa7 + 7025063 commit 29d600e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@ public ResponseEntity<String> updateFundingOrganisation(@RequestBody UpdateFundi
public ResponseEntity<Void> checkNewAdminEmailIsValid(
@RequestBody @Valid final CheckNewAdminEmailDto checkNewAdminEmailDto, final HttpServletRequest request) {
// 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())) {
final String newAdminEmail = checkNewAdminEmailDto.getEmailAddress().toLowerCase();
if (newAdminEmail.equals(checkNewAdminEmailDto.getOldEmailAddress())) {
throw new FieldViolationException("emailAddress", "This user already owns this grant.");
}

try {
final String jwt = HelperUtils.getJwtFromCookies(request, userServiceConfig.getCookieName());
userService.getGrantAdminIdFromUserServiceEmail(checkNewAdminEmailDto.getEmailAddress(), jwt);
userService.getGrantAdminIdFromUserServiceEmail(newAdminEmail, jwt);
}
catch (Exception e) {
throw new FieldViolationException("emailAddress", "Email address does not belong to an admin user");
Expand Down

0 comments on commit 29d600e

Please sign in to comment.