Skip to content

Commit 0c2b025

Browse files
committed
fix issue #573
1 parent fc18a41 commit 0c2b025

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

server/src/main/java/password/pwm/http/servlet/activation/ActivateUserServlet.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,12 @@ public ProcessStatus handleEnterCode(
338338
TokenService.TokenEntryType.unauthenticated
339339
);
340340

341-
activateUserBean.setUserIdentity( tokenPayload.getUserIdentity() );
341+
if ( activateUserBean.getUserIdentity() == null )
342+
{
343+
ActivateUserUtils.initUserActivationBean( pwmRequest, tokenPayload.getUserIdentity() );
344+
}
345+
342346
activateUserBean.setTokenPassed( true );
343-
activateUserBean.setFormValidated( true );
344-
activateUserBean.setTokenDestination( tokenPayload.getDestination() );
345347
activateUserBean.setTokenSent( true );
346348

347349
if ( pwmRequest.getConfig().readSettingAsBoolean( PwmSetting.DISPLAY_TOKEN_SUCCESS_BUTTON ) )
@@ -413,7 +415,7 @@ protected void nextStep( final PwmRequest pwmRequest ) throws PwmUnrecoverableEx
413415
final ActivateUserProfile activateUserProfile = activateUserProfile( pwmRequest );
414416

415417
final MessageSendMethod tokenSendMethod = activateUserProfile.readSettingAsEnum( PwmSetting.ACTIVATE_TOKEN_SEND_METHOD, MessageSendMethod.class );
416-
if ( tokenSendMethod != MessageSendMethod.NONE && tokenSendMethod != null )
418+
if ( !activateUserBean.isTokenPassed() && tokenSendMethod != MessageSendMethod.NONE && tokenSendMethod != null )
417419
{
418420
final List<TokenDestinationItem> tokenDestinationItems = TokenUtil.figureAvailableTokenDestinations(
419421
pwmApplication,
@@ -459,14 +461,16 @@ protected void nextStep( final PwmRequest pwmRequest ) throws PwmUnrecoverableEx
459461
}
460462
}
461463

462-
final String agreementText = activateUserProfile.readSettingAsLocalizedString(
463-
PwmSetting.ACTIVATE_AGREEMENT_MESSAGE,
464-
pwmSession.getSessionStateBean().getLocale()
465-
);
466-
if ( !StringUtil.isEmpty( agreementText ) && !activateUserBean.isAgreementPassed() )
467464
{
468-
ActivateUserUtils.forwardToAgreementPage( pwmRequest );
469-
return;
465+
final String agreementText = activateUserProfile.readSettingAsLocalizedString(
466+
PwmSetting.ACTIVATE_AGREEMENT_MESSAGE,
467+
pwmSession.getSessionStateBean().getLocale()
468+
);
469+
if ( !StringUtil.isEmpty( agreementText ) && !activateUserBean.isAgreementPassed() )
470+
{
471+
ActivateUserUtils.forwardToAgreementPage( pwmRequest );
472+
return;
473+
}
470474
}
471475

472476
try

0 commit comments

Comments
 (0)