Skip to content

Commit

Permalink
ZCS-15588: Addressed review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
zimsuchitgupta committed Aug 8, 2024
1 parent 6690f60 commit 5f36cb1
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions store/src/java/com/zimbra/cs/service/account/ChangePassword.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,21 @@ public Element handle(Element request, Map<String, Object> context) throws Servi
prov.setPassword(acct, newPassword, true);
acct.setVirtualAccountInitialPasswordSet(true);
} else if (authTokenEl != null) {
AuthToken at;
try {
AuthToken at = AuthProvider.getAuthToken(authTokenEl, acct);
Account authTokenAcct = AuthProvider.validateAuthToken(prov, at, false, AuthToken.Usage.RESET_PASSWORD);
if (authTokenAcct != null && AuthToken.Usage.RESET_PASSWORD == at.getUsage()) {
prov.changePassword(acct, oldPassword, newPassword, dryRun);
try {
at.deRegister();
} catch (AuthTokenException e) {
throw ServiceException.FAILURE("cannot de-register reset password auth token", e);
}
}
at = AuthProvider.getAuthToken(authTokenEl, acct);
} catch (AuthTokenException e) {
throw ServiceException.AUTH_REQUIRED();
}
Account authTokenAcct = AuthProvider.validateAuthToken(prov, at, false, AuthToken.Usage.RESET_PASSWORD);
if (authTokenAcct != null && at != null && AuthToken.Usage.RESET_PASSWORD == at.getUsage()) {
prov.changePassword(acct, oldPassword, newPassword, dryRun);
try {
at.deRegister();
} catch (AuthTokenException e) {
throw ServiceException.FAILURE("cannot de-register reset password auth token", e);
}
}
} else {
prov.changePassword(acct, oldPassword, newPassword, dryRun);
}
Expand Down

0 comments on commit 5f36cb1

Please sign in to comment.