Skip to content

Commit

Permalink
ZCS-12907: set context path on password recovery page
Browse files Browse the repository at this point in the history
  • Loading branch information
k-kato committed Feb 1, 2023
1 parent 6ebcc09 commit 316e0bd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
ZmPasswordRecoveryDialog =
function(params) {
this.accountInput = params.accountInput || '';
this.contextPath = params.contextPath || '';

var emailSubmitButton = new DwtDialog_ButtonDescriptor(ZmPasswordRecoveryDialog.EMAIL_SUBMIT_BUTTON,
ZmMsg.passwordRecoveryButtonSubmit,
Expand Down Expand Up @@ -126,7 +127,7 @@ function() {
this._twoFactorCodeDivId = id + '_two_factor_code';

this._divIdArray = [this._getRecoveryAccountDivId, this._requestCodeDivId, this._validateCodeDivId, this._codeSuccessDivId, this._resetPasswordDivId, this._passwordResetSuccessDivId, this._twoFactorCodeDivId];
return AjxTemplate.expand('share.Dialogs#ZmPasswordRecovery', {id : id, accountInput : this.accountInput});
return AjxTemplate.expand('share.Dialogs#ZmPasswordRecovery', {id : id, accountInput : this.accountInput, contextPath : this.contextPath});
};

/**
Expand Down Expand Up @@ -386,7 +387,7 @@ function(result) {
Dwt.hide(this._trustedDeviceDiv);
}
} else {
location.replace(location.origin);
location.replace(location.origin + this.contextPath);
}

}
Expand Down Expand Up @@ -1087,7 +1088,7 @@ function() {

ZmPasswordRecoveryDialog.prototype._handleCancelResetPasswordRequest =
function () {
location.replace(location.origin);
location.replace(location.origin + this.contextPath);
}

/**
Expand Down Expand Up @@ -1121,6 +1122,6 @@ function(result) {
this._handleResetPasswordError(this._validateTwoFactorErrorDiv, this._validateTwoFactorErrorMessageDiv, result.getException());
} else {
this.setButtonEnabled(ZmPasswordRecoveryDialog.TWO_FACTOR_VERIFY_BUTTON, false);
location.replace(location.origin);
location.replace(location.origin + this.contextPath);
}
}
4 changes: 3 additions & 1 deletion WebRoot/public/PasswordRecovery.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
if (contextPath.equals("/")) {
contextPath = "";
}
pageContext.setAttribute("contextPath", contextPath);
boolean isDevMode = getParameter(request, "dev", "0").equals("1");
pageContext.setAttribute("isDevMode", isDevMode);
Expand Down Expand Up @@ -98,7 +99,8 @@
DBG = new AjxDebug(AjxDebug.NONE, null, false);
}
var params = {
accountInput : "<%=accountInput%>"
accountInput : "<%=accountInput%>",
contextPath : "<%=contextPath%>"
};
new ZmPasswordRecoveryDialog(params).popup();
var changeTag = document.getElementsByClassName("DwtDialogTitle")[0];
Expand Down
5 changes: 4 additions & 1 deletion WebRoot/public/login.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<fmt:setBundle basename="/messages/ZmMsg" scope="request"/>
<fmt:setBundle basename="/messages/ZhMsg" var="zhmsg" scope="request"/>
<fmt:setBundle basename="/messages/ZMsg" var="zmsg" scope="request"/>
<c:if test="${pageContext.request.contextPath ne '/'}">
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
</c:if>

<%-- query params to ignore when constructing form port url or redirect url --%>
<c:set var="ignoredQueryParams" value=",loginOp,loginNewPassword,totpcode,loginConfirmNewPassword,loginErrorCode,username,email,password,zrememberme,ztrusteddevice,zlastserver,client,login_csrf,"/>
Expand Down Expand Up @@ -784,7 +787,7 @@ function clientChange(selectValue) {
function forgotPassword() {
var accountInput = getElement("username").value;
var queryParams = encodeURI("account=" + accountInput);
var url = "/public/PasswordRecovery.jsp?" + location.search;
var url = "${basePath}" + "/public/PasswordRecovery.jsp?" + location.search;
if (accountInput !== '') {
url += (location.search !== '' ? '&' : '') + encodeURI("account=" + accountInput);
Expand Down
32 changes: 16 additions & 16 deletions WebRoot/templates/share/Dialogs.template
Original file line number Diff line number Diff line change
Expand Up @@ -832,38 +832,38 @@
</div>
<ul id="${id}_password_rule_list" class="resetPasswordRuleList">
<li id="${id}_min_length">
<img src="/img/zimbra/ImgCloseGrayModern.png" id="minLengthCloseImg" style="display: inline;"/>
<img src="/img/zimbra/ImgCheckModern.png" id="minLengthCheckImg" style="display: none;"/>
<img src="${contextPath}/img/zimbra/ImgCloseGrayModern.png" id="minLengthCloseImg" style="display: inline;"/>
<img src="${contextPath}/img/zimbra/ImgCheckModern.png" id="minLengthCheckImg" style="display: none;"/>
<label id="${id}_min_length_label" class="ZmPasswordRecoveryRule"/>
</li>
<li id="${id}_min_upper_case_chars">
<img src="/img/zimbra/ImgCloseGrayModern.png" id="minUpperCaseCloseImg" style="display: inline;"/>
<img src="/img/zimbra/ImgCheckModern.png" id="minUpperCaseCheckImg" style="display: none;"/>
<img src="${contextPath}/img/zimbra/ImgCloseGrayModern.png" id="minUpperCaseCloseImg" style="display: inline;"/>
<img src="${contextPath}/img/zimbra/ImgCheckModern.png" id="minUpperCaseCheckImg" style="display: none;"/>
<label id="${id}_min_upper_case_chars_label" class="ZmPasswordRecoveryRule"/>
</li>
<li id="${id}_min_lower_case_chars">
<img src="/img/zimbra/ImgCloseGrayModern.png" id="minLowerCaseCloseImg" style="display: inline;"/>
<img src="/img/zimbra/ImgCheckModern.png" id="minLowerCaseCheckImg" style="display: none;"/>
<img src="${contextPath}/img/zimbra/ImgCloseGrayModern.png" id="minLowerCaseCloseImg" style="display: inline;"/>
<img src="${contextPath}/img/zimbra/ImgCheckModern.png" id="minLowerCaseCheckImg" style="display: none;"/>
<label id="${id}_min_lower_case_chars_label" class="ZmPasswordRecoveryRule"/>
</li>
<li id="${id}_min_punctuation_chars">
<img src="/img/zimbra/ImgCloseGrayModern.png" id="minPunctuationCharsCloseImg" style="display: inline;"/>
<img src="/img/zimbra/ImgCheckModern.png" id="minPunctuationCharsCheckImg" style="display: none;"/>
<img src="${contextPath}/img/zimbra/ImgCloseGrayModern.png" id="minPunctuationCharsCloseImg" style="display: inline;"/>
<img src="${contextPath}/img/zimbra/ImgCheckModern.png" id="minPunctuationCharsCheckImg" style="display: none;"/>
<label id="${id}_min_punctuation_chars_label" class="ZmPasswordRecoveryRule"/>
</li>
<li id="${id}_min_numeric_chars">
<img src="/img/zimbra/ImgCloseGrayModern.png" id="minNumericCharsCloseImg" style="display: inline;"/>
<img src="/img/zimbra/ImgCheckModern.png" id="minNumericCharsCheckImg" style="display: none;"/>
<img src="${contextPath}/img/zimbra/ImgCloseGrayModern.png" id="minNumericCharsCloseImg" style="display: inline;"/>
<img src="${contextPath}/img/zimbra/ImgCheckModern.png" id="minNumericCharsCheckImg" style="display: none;"/>
<label id="${id}_min_numeric_chars_label" class="ZmPasswordRecoveryRule"/>
</li>
<li id="${id}_min_digits_or_punctuations">
<img src="/img/zimbra/ImgCloseGrayModern.png" id="minDigitsOrPuncsCloseImg" style="display: inline;"/>
<img src="/img/zimbra/ImgCheckModern.png" id="minDigitsOrPuncsCheckImg" style="display: none;"/>
<img src="${contextPath}/img/zimbra/ImgCloseGrayModern.png" id="minDigitsOrPuncsCloseImg" style="display: inline;"/>
<img src="${contextPath}/img/zimbra/ImgCheckModern.png" id="minDigitsOrPuncsCheckImg" style="display: none;"/>
<label id="${id}_min_digits_or_punctuations_label" class="ZmPasswordRecoveryRule"/>
</li>
<li id="${id}_password_allow_username">
<img src="/img/zimbra/ImgCloseGrayModern.png" id="allowUsernameCloseImg" style="display: inline;"/>
<img src="/img/zimbra/ImgCheckModern.png" id="allowUsernameCheckImg" style="display: none;"/>
<img src="${contextPath}/img/zimbra/ImgCloseGrayModern.png" id="allowUsernameCloseImg" style="display: inline;"/>
<img src="${contextPath}/img/zimbra/ImgCheckModern.png" id="allowUsernameCheckImg" style="display: none;"/>
<label id="${id}_password_allow_username_label" class="ZmPasswordRecoveryRule"/>
</li>
</ul>
Expand All @@ -875,8 +875,8 @@
</div>
<ul class="confirmResetPasswordRuleList">
<li>
<img src="/img/zimbra/ImgCloseGrayModern.png" id="mustMatchCloseImg" style="display: inline;"/>
<img src="/img/zimbra/ImgCheckModern.png" id="mustMatchCheckImg" style="display: none;"/>
<img src="${contextPath}/img/zimbra/ImgCloseGrayModern.png" id="mustMatchCloseImg" style="display: inline;"/>
<img src="${contextPath}/img/zimbra/ImgCheckModern.png" id="mustMatchCheckImg" style="display: none;"/>
<label class="ZmPasswordRecoveryRule"><$=ZmMsg.zimbraPasswordMustMatch$><label>
</li>
</ul>
Expand Down

0 comments on commit 316e0bd

Please sign in to comment.