@@ -338,10 +338,12 @@ public ProcessStatus handleEnterCode(
338
338
TokenService .TokenEntryType .unauthenticated
339
339
);
340
340
341
- activateUserBean .setUserIdentity ( tokenPayload .getUserIdentity () );
341
+ if ( activateUserBean .getUserIdentity () == null )
342
+ {
343
+ ActivateUserUtils .initUserActivationBean ( pwmRequest , tokenPayload .getUserIdentity () );
344
+ }
345
+
342
346
activateUserBean .setTokenPassed ( true );
343
- activateUserBean .setFormValidated ( true );
344
- activateUserBean .setTokenDestination ( tokenPayload .getDestination () );
345
347
activateUserBean .setTokenSent ( true );
346
348
347
349
if ( pwmRequest .getConfig ().readSettingAsBoolean ( PwmSetting .DISPLAY_TOKEN_SUCCESS_BUTTON ) )
@@ -413,7 +415,7 @@ protected void nextStep( final PwmRequest pwmRequest ) throws PwmUnrecoverableEx
413
415
final ActivateUserProfile activateUserProfile = activateUserProfile ( pwmRequest );
414
416
415
417
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 )
417
419
{
418
420
final List <TokenDestinationItem > tokenDestinationItems = TokenUtil .figureAvailableTokenDestinations (
419
421
pwmApplication ,
@@ -459,14 +461,16 @@ protected void nextStep( final PwmRequest pwmRequest ) throws PwmUnrecoverableEx
459
461
}
460
462
}
461
463
462
- final String agreementText = activateUserProfile .readSettingAsLocalizedString (
463
- PwmSetting .ACTIVATE_AGREEMENT_MESSAGE ,
464
- pwmSession .getSessionStateBean ().getLocale ()
465
- );
466
- if ( !StringUtil .isEmpty ( agreementText ) && !activateUserBean .isAgreementPassed () )
467
464
{
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
+ }
470
474
}
471
475
472
476
try
0 commit comments