diff --git a/lib/WebGUI/AssetAspect/Subscriber.pm b/lib/WebGUI/AssetAspect/Subscriber.pm index 803ac1a..9557a59 100644 --- a/lib/WebGUI/AssetAspect/Subscriber.pm +++ b/lib/WebGUI/AssetAspect/Subscriber.pm @@ -40,6 +40,13 @@ sub definition { label => 'Allow anonymous subscription', tab => 'subscription', }, + confirmationRequiredTemplateId => { + fieldType => 'template', + defaultValue => 'd1tQuv-OlPwgz6PnLcq-hA', + label => 'Confirmation required template', + namespace => 'Subscriber/ConfirmationRequired', + tab => 'subscription', + }, confirmationEmailSubject => { fieldType => 'text', defaultVale => 'Confirm your subscription mutation', @@ -61,7 +68,7 @@ sub definition { }, noMutationEmailTemplateId => { fieldType => 'template', - defaultValue => '', + defaultValue => 'Q8t7dUqMk05D2m7Jbgg4BQ', label => 'No mutation email template', namespace => 'Subscriber/NoMutationEmail', tab => 'subscription', @@ -359,10 +366,12 @@ sub www_processSubscription { if ( $action eq 'unsubscribe' && $self->canUnsubscribe ) { $self->unsubscribe; } + + return unless $self->get('alwaysConfirmSubscription'); } elsif ( $self->get('allowAnonymousSubscription') ) { my $email = $form->email( 'email' ); - return 'no email' unless $email; + return 'Error: no email address passed' unless $email; my $emailUser = WebGUI::User::SpecialState->newByEmail( $session, $email ); if ( $action eq 'unsubscribe' && defined $emailUser ) { @@ -379,10 +388,10 @@ sub www_processSubscription { } } else { - return 'anonymous subscription is not allowed.' + return $self->processStyle( 'Anonymous subscription is not allowed. Please log in to (un)subscribe' ); } - return; + return $self->processStyle( $self->processTemplate( {}, $self->get('confirmationRequiredTemplateId') ) ); } #---------------------------------------------------------------------------- diff --git a/sbin/install_newsletter.pl b/sbin/install_newsletter.pl index c6dbb54..fe8dfd6 100644 --- a/sbin/install_newsletter.pl +++ b/sbin/install_newsletter.pl @@ -60,6 +60,7 @@ sub installSubscriberAspectTable { subscriptionEnabled tinyint(1) not null default 0, alwaysConfirmSubscription tinyint(1) not null default 0, allowAnonymousSubscription tinyint(1) not null default 0, + confirmationRequiredTemplateId char(22) binary, confirmationEmailTemplateId char(22) binary, confirmationEmailSubject varchar(255), noMutationEmailTemplateId char(22) binary, diff --git a/sbin/packages/root_import_personalnewsletter.wgpkg b/sbin/packages/root_import_personalnewsletter.wgpkg index 815eccd..bdfe09b 100644 Binary files a/sbin/packages/root_import_personalnewsletter.wgpkg and b/sbin/packages/root_import_personalnewsletter.wgpkg differ