/portal-web/docroot/html/portal/update_password.jsp

http://github.com/liferay/liferay-portal · JavaServer Pages · 200 lines · 153 code · 34 blank · 13 comment · 2 complexity · c8c02e10b342b20405939f421e97babf MD5 · raw file

  1. <%--
  2. /**
  3. * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
  4. *
  5. * This library is free software; you can redistribute it and/or modify it under
  6. * the terms of the GNU Lesser General Public License as published by the Free
  7. * Software Foundation; either version 2.1 of the License, or (at your option)
  8. * any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  13. * details.
  14. */
  15. --%>
  16. <%@ include file="/html/portal/init.jsp" %>
  17. <%
  18. String currentURL = PortalUtil.getCurrentURL(request);
  19. String referer = ParamUtil.getString(request, WebKeys.REFERER, currentURL);
  20. Ticket ticket = (Ticket)request.getAttribute(WebKeys.TICKET);
  21. String ticketKey = ParamUtil.getString(request, "ticketKey");
  22. if (referer.startsWith(themeDisplay.getPathMain() + "/portal/update_password") && Validator.isNotNull(ticketKey)) {
  23. referer = themeDisplay.getPathMain();
  24. }
  25. %>
  26. <div class="sheet sheet-lg">
  27. <div class="sheet-header">
  28. <div class="autofit-padded-no-gutters-x autofit-row">
  29. <div class="autofit-col autofit-col-expand">
  30. <h2 class="sheet-title">
  31. <liferay-ui:message key="change-password" />
  32. </h2>
  33. </div>
  34. <div class="autofit-col">
  35. <%@ include file="/html/portal/select_language.jspf" %>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="sheet-text">
  40. <c:choose>
  41. <c:when test="<%= !themeDisplay.isSignedIn() && (ticket == null) %>">
  42. <div class="alert alert-warning">
  43. <liferay-ui:message key="your-password-reset-link-is-no-longer-valid" />
  44. <%
  45. PortletURL portletURL = PortletURLFactoryUtil.create(request, PortletKeys.LOGIN, PortletRequest.RENDER_PHASE);
  46. portletURL.setParameter("mvcRenderCommandName", "/login/forgot_password");
  47. portletURL.setWindowState(WindowState.MAXIMIZED);
  48. %>
  49. <div class="reset-link-contaner">
  50. <aui:a href="<%= portletURL.toString() %>" label="request-a-new-password-reset-link"></aui:a>
  51. </div>
  52. </div>
  53. </c:when>
  54. <c:when test="<%= SessionErrors.contains(request, UserLockoutException.LDAPLockout.class.getName()) %>">
  55. <div class="alert alert-danger">
  56. <liferay-ui:message key="this-account-is-locked" />
  57. </div>
  58. </c:when>
  59. <c:when test="<%= SessionErrors.contains(request, UserLockoutException.PasswordPolicyLockout.class.getName()) %>">
  60. <div class="alert alert-danger">
  61. <%
  62. UserLockoutException.PasswordPolicyLockout ule = (UserLockoutException.PasswordPolicyLockout)SessionErrors.get(request, UserLockoutException.PasswordPolicyLockout.class.getName());
  63. Format dateFormat = FastDateFormatFactoryUtil.getDateTime(FastDateFormatConstants.SHORT, FastDateFormatConstants.LONG, locale, TimeZone.getTimeZone(ule.user.getTimeZoneId()));
  64. %>
  65. <liferay-ui:message arguments="<%= dateFormat.format(ule.user.getUnlockDate()) %>" key="this-account-is-locked-until-x" translateArguments="<%= false %>" />
  66. </div>
  67. </c:when>
  68. <c:otherwise>
  69. <aui:form action='<%= themeDisplay.getPathMain() + "/portal/update_password" %>' method="post" name="fm">
  70. <aui:input name="p_l_id" type="hidden" value="<%= layout.getPlid() %>" />
  71. <aui:input name="p_auth" type="hidden" value="<%= AuthTokenUtil.getToken(request) %>" />
  72. <aui:input name="doAsUserId" type="hidden" value="<%= themeDisplay.getDoAsUserId() %>" />
  73. <aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" />
  74. <aui:input name="<%= WebKeys.REFERER %>" type="hidden" value="<%= referer %>" />
  75. <aui:input name="ticketKey" type="hidden" value="<%= ticketKey %>" />
  76. <c:if test="<%= !SessionErrors.isEmpty(request) %>">
  77. <div class="alert alert-danger">
  78. <c:choose>
  79. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustBeLonger.class.getName()) %>">
  80. <%
  81. UserPasswordException.MustBeLonger upe = (UserPasswordException.MustBeLonger)SessionErrors.get(request, UserPasswordException.MustBeLonger.class.getName());
  82. %>
  83. <liferay-ui:message arguments="<%= String.valueOf(upe.minLength) %>" key="that-password-is-too-short" translateArguments="<%= false %>" />
  84. </c:when>
  85. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustComplyWithModelListeners.class.getName()) %>">
  86. <liferay-ui:message key="that-password-is-invalid-please-enter-a-different-password" />
  87. </c:when>
  88. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustComplyWithRegex.class.getName()) %>">
  89. <%
  90. UserPasswordException.MustComplyWithRegex upe = (UserPasswordException.MustComplyWithRegex)SessionErrors.get(request, UserPasswordException.MustComplyWithRegex.class.getName());
  91. %>
  92. <liferay-ui:message arguments="<%= upe.regex %>" key="that-password-does-not-comply-with-the-regular-expression" translateArguments="<%= false %>" />
  93. </c:when>
  94. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustHaveMoreAlphanumeric.class.getName()) %>">
  95. <%
  96. UserPasswordException.MustHaveMoreAlphanumeric upe = (UserPasswordException.MustHaveMoreAlphanumeric)SessionErrors.get(request, UserPasswordException.MustHaveMoreAlphanumeric.class.getName());
  97. %>
  98. <liferay-ui:message arguments="<%= String.valueOf(upe.minAlphanumeric) %>" key="that-password-must-contain-at-least-x-alphanumeric-characters" translateArguments="<%= false %>" />
  99. </c:when>
  100. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustHaveMoreLowercase.class.getName()) %>">
  101. <%
  102. UserPasswordException.MustHaveMoreLowercase upe = (UserPasswordException.MustHaveMoreLowercase)SessionErrors.get(request, UserPasswordException.MustHaveMoreLowercase.class.getName());
  103. %>
  104. <liferay-ui:message arguments="<%= String.valueOf(upe.minLowercase) %>" key="that-password-must-contain-at-least-x-lowercase-characters" translateArguments="<%= false %>" />
  105. </c:when>
  106. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustHaveMoreNumbers.class.getName()) %>">
  107. <%
  108. UserPasswordException.MustHaveMoreNumbers upe = (UserPasswordException.MustHaveMoreNumbers)SessionErrors.get(request, UserPasswordException.MustHaveMoreNumbers.class.getName());
  109. %>
  110. <liferay-ui:message arguments="<%= String.valueOf(upe.minNumbers) %>" key="that-password-must-contain-at-least-x-numbers" translateArguments="<%= false %>" />
  111. </c:when>
  112. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustHaveMoreSymbols.class.getName()) %>">
  113. <%
  114. UserPasswordException.MustHaveMoreSymbols upe = (UserPasswordException.MustHaveMoreSymbols)SessionErrors.get(request, UserPasswordException.MustHaveMoreSymbols.class.getName());
  115. %>
  116. <liferay-ui:message arguments="<%= String.valueOf(upe.minSymbols) %>" key="that-password-must-contain-at-least-x-symbols" translateArguments="<%= false %>" />
  117. </c:when>
  118. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustHaveMoreUppercase.class.getName()) %>">
  119. <%
  120. UserPasswordException.MustHaveMoreUppercase upe = (UserPasswordException.MustHaveMoreUppercase)SessionErrors.get(request, UserPasswordException.MustHaveMoreUppercase.class.getName());
  121. %>
  122. <liferay-ui:message arguments="<%= String.valueOf(upe.minUppercase) %>" key="that-password-must-contain-at-least-x-uppercase-characters" translateArguments="<%= false %>" />
  123. </c:when>
  124. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustMatch.class.getName()) %>">
  125. <liferay-ui:message key="the-passwords-you-entered-do-not-match" />
  126. </c:when>
  127. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustNotBeEqualToCurrent.class.getName()) %>">
  128. <liferay-ui:message key="your-new-password-cannot-be-the-same-as-your-old-password-please-enter-a-different-password" />
  129. </c:when>
  130. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustNotBeNull.class.getName()) %>">
  131. <liferay-ui:message key="the-password-cannot-be-blank" />
  132. </c:when>
  133. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustNotBeRecentlyUsed.class.getName()) %>">
  134. <liferay-ui:message key="that-password-has-already-been-used-please-enter-a-different-password" />
  135. </c:when>
  136. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustNotBeTrivial.class.getName()) %>">
  137. <liferay-ui:message key="that-password-uses-common-words-please-enter-a-password-that-is-harder-to-guess-i-e-contains-a-mix-of-numbers-and-letters" />
  138. </c:when>
  139. <c:when test="<%= SessionErrors.contains(request, UserPasswordException.MustNotContainDictionaryWords.class.getName()) %>">
  140. <liferay-ui:message key="that-password-uses-common-dictionary-words" />
  141. </c:when>
  142. <c:otherwise>
  143. <liferay-ui:message key="your-request-failed-to-complete" />
  144. </c:otherwise>
  145. </c:choose>
  146. </div>
  147. </c:if>
  148. <aui:fieldset>
  149. <aui:input autoFocus="<%= true %>" class="lfr-input-text-container" label="password" name="password1" showRequiredLabel="<%= false %>" type="password">
  150. <aui:validator name="required" />
  151. </aui:input>
  152. <aui:input class="lfr-input-text-container" label="enter-again" name="password2" showRequiredLabel="<%= false %>" type="password">
  153. <aui:validator name="equalTo">
  154. '#<portlet:namespace />password1'
  155. </aui:validator>
  156. <aui:validator name="required" />
  157. </aui:input>
  158. </aui:fieldset>
  159. <aui:button-row>
  160. <aui:button type="submit" />
  161. </aui:button-row>
  162. </aui:form>
  163. </c:otherwise>
  164. </c:choose>
  165. </div>
  166. </div>