掲示板

Password Reset Link expired when entered wrong password

7年前 に Robert Meissner によって更新されました。

Password Reset Link expired when entered wrong password

Junior Member 投稿: 76 参加年月日: 15/02/26 最新の投稿
Hallo,

i am using Liferay CE 6.2 GA6 and the following code to create a password-reset link in the welcome-emails for my users:


final Ticket ticket = TicketLocalServiceUtil.addTicket(user.getCompanyId(), User.class.getName(), user.getUserId(), TicketConstants.TYPE_PASSWORD, null, getExpirationDate(FUTURE_DAYS), null);
final String passwordResetURL = "https://localhost:8080/c/portal/update_password?ticketKey=" + ticket.getKey();


The link is working, and when i enter the new password twice, it works.
But when i enter a wrong password, or two different passwords, i get the message, that the link expired.
Paradoxically i can still use the link from the mail as long as it intended. Is it a bug or how can i solve it?
7年前 に Robert Meissner によって更新されました。

RE: Password Reset Link expired when entered wrong password

Junior Member 投稿: 76 参加年月日: 15/02/26 最新の投稿
I found out, that the
Ticket ticket = (Ticket)request.getAttribute(WebKeys.TICKET);

in
html/portal/update_password.jsp

is null, after the user enters a password that does not fulfil the policy.

I entered custom validators as a workaround. Can this be disabled by disabling Javascript in the browser?! I haven't tested...
<aui:fieldset label="new-password">
	<aui:input autofocus="<%= true %>" class="lfr-input-text-container" label="password" name="password1" type="password">
		<aui:validator name="required" />
		<aui:validator name="minLength">6</aui:validator>
		<aui:validator name="custom" errormessage="Mindestens ein Großbuchstabe und eine Zahl.">
			function (val, fieldNode, ruleValue) {
				var oneNumeric = false;
				var oneUppercase = false;
				if (val) {
					var strings = val;
					var i=0;
					var character='';
					while (i &lt;= strings.length){
					    character = strings.charAt(i);
					    if (!isNaN(character * 1)){
					        oneNumeric = true;
					    } else{
					        if (character == character.toUpperCase()) {
					            oneUppercase = true;
					        }
					        if (character == character.toLowerCase()){
					        }
					    }
					    i++;
					}
				}
				return (oneNumeric &amp;&amp; oneUppercase);
			}
		</aui:validator>
	</aui:input>

	<aui:input class="lfr-input-text-container" label="enter-again" name="password2" type="password">
		<aui:validator name="required" />
		<aui:validator name="equalTo">
			'#<portlet:namespace />password1'
		</aui:validator>
	</aui:input>
</aui:fieldset>