Make the password recovery email templatable. Includes i18n, help docs, upgrade sub, template package and code. Fixes bug #11918.
This commit is contained in:
parent
859076fda8
commit
f159fab19b
6 changed files with 65 additions and 3 deletions
|
|
@ -14,6 +14,7 @@
|
||||||
- fixed #11912: Corrupt cookie causes server 500 errors
|
- fixed #11912: Corrupt cookie causes server 500 errors
|
||||||
- fixed #11919: Survey rendering with section text
|
- fixed #11919: Survey rendering with section text
|
||||||
- fixed #11916: Collaboration System security
|
- fixed #11916: Collaboration System security
|
||||||
|
- fixed #11918: Make password recovery email templatable
|
||||||
|
|
||||||
7.10.2
|
7.10.2
|
||||||
- fixed #11884: Editing Templates impossible / Code editor not loaded
|
- fixed #11884: Editing Templates impossible / Code editor not loaded
|
||||||
|
|
|
||||||
BIN
docs/upgrades/packages-7.10.3/root_import_auth.wgpkg
Normal file
BIN
docs/upgrades/packages-7.10.3/root_import_auth.wgpkg
Normal file
Binary file not shown.
|
|
@ -33,6 +33,7 @@ my $session = start(); # this line required
|
||||||
# upgrade functions go here
|
# upgrade functions go here
|
||||||
pruneInboxMessagesFromDeletedUsers($session);
|
pruneInboxMessagesFromDeletedUsers($session);
|
||||||
addTemplateToNotifyAboutVersionTag($session);
|
addTemplateToNotifyAboutVersionTag($session);
|
||||||
|
addPasswordRecoveryEmailTemplate($session);
|
||||||
|
|
||||||
finish($session); # this line required
|
finish($session); # this line required
|
||||||
|
|
||||||
|
|
@ -83,6 +84,16 @@ sub addTemplateToNotifyAboutVersionTag {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Describe what our function does
|
||||||
|
sub addPasswordRecoveryEmailTemplate {
|
||||||
|
my $session = shift;
|
||||||
|
print "\tAdd a template for the password recovery email." unless $quiet;
|
||||||
|
$session->setting->add('webguiPasswordRecoveryEmailTemplate', 'sK_0zVw4kwdJ1sqREIsSzA');
|
||||||
|
print "...DONE!\n" unless $quiet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ use WebGUI::Storage;
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use WebGUI::Form::Captcha;
|
use WebGUI::Form::Captcha;
|
||||||
|
use WebGUI::Macro;
|
||||||
use Encode ();
|
use Encode ();
|
||||||
|
|
||||||
our @ISA = qw(WebGUI::Auth);
|
our @ISA = qw(WebGUI::Auth);
|
||||||
|
|
@ -609,6 +610,13 @@ sub editUserSettingsForm {
|
||||||
-label => $i18n->get("password recovery template"),
|
-label => $i18n->get("password recovery template"),
|
||||||
-hoverHelp => $i18n->get("password recovery template help")
|
-hoverHelp => $i18n->get("password recovery template help")
|
||||||
);
|
);
|
||||||
|
$f->template(
|
||||||
|
-name => "webguiPasswordRecoveryEmailTemplate",
|
||||||
|
-value => $self->session->setting->get('webguiPasswordRecoveryEmailTemplate'),
|
||||||
|
-label => $i18n->get('Password Recovery Email Template'),
|
||||||
|
-hoverHelp => $i18n->get("password recovery email template help"),
|
||||||
|
-namespace => "Auth/WebGUI/RecoveryEmail",
|
||||||
|
);
|
||||||
$f->template(
|
$f->template(
|
||||||
-name => "webguiWelcomeMessageTemplate",
|
-name => "webguiWelcomeMessageTemplate",
|
||||||
-value => $self->session->setting->get("webguiWelcomeMessageTemplate"),
|
-value => $self->session->setting->get("webguiWelcomeMessageTemplate"),
|
||||||
|
|
@ -678,6 +686,8 @@ sub editUserSettingsFormSave {
|
||||||
$s->set("webguiPasswordRecoveryTemplate", $f->process("webguiPasswordRecoveryTemplate","template"));
|
$s->set("webguiPasswordRecoveryTemplate", $f->process("webguiPasswordRecoveryTemplate","template"));
|
||||||
$s->set("webguiWelcomeMessageTemplate", $f->process("webguiWelcomeMessageTemplate","template"));
|
$s->set("webguiWelcomeMessageTemplate", $f->process("webguiWelcomeMessageTemplate","template"));
|
||||||
$s->set("webguiAccountActivationTemplate", $f->process("webguiAccountActivationTemplate","template"));
|
$s->set("webguiAccountActivationTemplate", $f->process("webguiAccountActivationTemplate","template"));
|
||||||
|
$s->set("webguiPasswordRecoveryTemplate", $f->process("webguiPasswordRecoveryTemplate","template"));
|
||||||
|
$s->set("webguiPasswordRecoveryEmailTemplate", $f->process("webguiPasswordRecoveryEmailTemplate","template"));
|
||||||
|
|
||||||
if (@errors) {
|
if (@errors) {
|
||||||
return \@errors;
|
return \@errors;
|
||||||
|
|
@ -1102,7 +1112,6 @@ sub emailRecoverPasswordFinish {
|
||||||
|
|
||||||
# generate information necessry to proceed
|
# generate information necessry to proceed
|
||||||
my $recoveryGuid = $session->id->generate();
|
my $recoveryGuid = $session->id->generate();
|
||||||
my $url = $session->url->getSiteURL;
|
|
||||||
my $userId = $user->userId; #get the user guid
|
my $userId = $user->userId; #get the user guid
|
||||||
$email = $user->profileField('email');
|
$email = $user->profileField('email');
|
||||||
|
|
||||||
|
|
@ -1116,7 +1125,12 @@ sub emailRecoverPasswordFinish {
|
||||||
$self->saveParams($userId, 'WebGUI', $authsettings);
|
$self->saveParams($userId, 'WebGUI', $authsettings);
|
||||||
|
|
||||||
my $mail = WebGUI::Mail::Send->create($session, { to=>$email, subject=>$i18n->get('WebGUI password recovery')});
|
my $mail = WebGUI::Mail::Send->create($session, { to=>$email, subject=>$i18n->get('WebGUI password recovery')});
|
||||||
$mail->addText($i18n->get('recover password email text1', 'AuthWebGUI') . $url. ". \n\n".$i18n->get('recover password email text2', 'AuthWebGUI')." \n\n ".$url."?op=auth;method=emailResetPassword;token=$recoveryGuid"."\n\n ". $i18n->get('recover password email text3', 'AuthWebGUI'));
|
my $vars = { };
|
||||||
|
$vars->{recoverPasswordUrl} = $session->url->append($session->url->getSiteURL,'?op=auth;method=emailResetPassword;token='.$recoveryGuid);
|
||||||
|
my $template = WebGUI::Asset->newByDynamicClass($session, $session->setting->get('webguiPasswordRecoveryEmailTemplate'));
|
||||||
|
my $emailText = $template->process($vars);
|
||||||
|
WebGUI::Macro::process($session, \$emailText);
|
||||||
|
$mail->addText($emailText);
|
||||||
$mail->queue;
|
$mail->queue;
|
||||||
return "<h1>". $i18n->get('recover password banner', 'AuthWebGUI')." </h1> <br> <br> <h3>". $i18n->get('email recover password finish message', 'AuthWebGUI') . "</h3>";
|
return "<h1>". $i18n->get('recover password banner', 'AuthWebGUI')." </h1> <br> <br> <h3>". $i18n->get('email recover password finish message', 'AuthWebGUI') . "</h3>";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,16 @@ our $HELP = {
|
||||||
related => []
|
related => []
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'webgui authentication password recovery email template' => {
|
||||||
|
title => 'recovery email template title',
|
||||||
|
body => '',
|
||||||
|
variables => [
|
||||||
|
{ 'name' => 'recoverPasswordUrl', },
|
||||||
|
],
|
||||||
|
fields => [],
|
||||||
|
related => []
|
||||||
|
},
|
||||||
|
|
||||||
'webgui authentication password expiration template' => {
|
'webgui authentication password expiration template' => {
|
||||||
title => 'expired template title',
|
title => 'expired template title',
|
||||||
body => '',
|
body => '',
|
||||||
|
|
|
||||||
|
|
@ -735,8 +735,9 @@ Settings screen, displayed as hoverhelp.|,
|
||||||
},
|
},
|
||||||
|
|
||||||
'recover password email text1' => {
|
'recover password email text1' => {
|
||||||
message => q|We have received your request to change the password for |,
|
message => q|We have received your request to change the password for %s.|,
|
||||||
lastUpdated => 1189780432,
|
lastUpdated => 1189780432,
|
||||||
|
context => q|%s is the URL of the site|,
|
||||||
},
|
},
|
||||||
|
|
||||||
'recover password email text2' => {
|
'recover password email text2' => {
|
||||||
|
|
@ -823,6 +824,31 @@ Settings screen, displayed as hoverhelp.|,
|
||||||
lastUpdated => 0,
|
lastUpdated => 0,
|
||||||
context => q|Description of the webguiUseEmailAsUsername field, used as hoverhelp on the Auth tab of the Edit Settings screen.|,
|
context => q|Description of the webguiUseEmailAsUsername field, used as hoverhelp on the Auth tab of the Edit Settings screen.|,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'Password Recovery Email Template' => {
|
||||||
|
message => 'Password Recovery Email Template',
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q|Label in the auth settings|,
|
||||||
|
},
|
||||||
|
|
||||||
|
'password recovery email template help' => {
|
||||||
|
message => 'Choose a template to style the emails sent out for recovering passwords',
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q|Label in the auth settings|,
|
||||||
|
},
|
||||||
|
|
||||||
|
'recovery email template title' => {
|
||||||
|
message => 'WebGUI Authentication Password Recovery Email Template',
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q|template help|,
|
||||||
|
},
|
||||||
|
|
||||||
|
'recoverPasswordUrl' => {
|
||||||
|
message => 'The URL for the user to visit to reset their password.',
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q|template help|,
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue