diff --git a/lib/WebGUI/AssetAspect/Subscriber.pm b/lib/WebGUI/AssetAspect/Subscriber.pm index 5406ea3..272e14a 100644 --- a/lib/WebGUI/AssetAspect/Subscriber.pm +++ b/lib/WebGUI/AssetAspect/Subscriber.pm @@ -8,6 +8,7 @@ use Carp; use WebGUI::Asset::Template; use WebGUI::Macro; use Tie::IxHash; +use URI; #---------------------------------------------------------------------------- sub definition { @@ -226,6 +227,21 @@ sub getSubscriptionGroup { return $group; } +#---------------------------------------------------------------------------- +sub getReturnUrl { + my $self = shift; + my $referer = $self->session->env->get('HTTP_REFERER'); + + return unless $referer; + + # Get path and strip leading and trailing slash if it exists. + my ( $path ) = URI->new( $referer )->path =~ m{ ^/ (.*?) /?$ }xms; + + return $referer if WebGUI::Asset->urlExists( $self->session, $path ); + + return; +} + #---------------------------------------------------------------------------- sub getEmailVars { my $self = shift; @@ -498,7 +514,12 @@ sub www_processSubscription { return $self->processStyle( $i18n->get( 'anonnymous not allowed' ) ); } - return $self->processStyle( $self->processTemplate( {}, $self->get('confirmationRequiredTemplateId') ) ); + my $var = { + assetUrl => $self->getUrl, + returnUrl => $self->getReturnUrl, + }; + + return $self->processStyle( $self->processTemplate( $var, $self->get('confirmationRequiredTemplateId') ) ); } #---------------------------------------------------------------------------- diff --git a/sbin/packages/root_import_personalnewsletter.wgpkg b/sbin/packages/root_import_personalnewsletter.wgpkg index e7ddbd6..a96e715 100644 Binary files a/sbin/packages/root_import_personalnewsletter.wgpkg and b/sbin/packages/root_import_personalnewsletter.wgpkg differ