backporting template email password recovery fix

This commit is contained in:
Colin Kuskie 2008-11-20 21:55:00 +00:00
parent 1573fba55e
commit d98afcc7af
5 changed files with 265 additions and 150 deletions

View file

@ -450,111 +450,128 @@ sub editUserSettingsForm {
my $i18n = WebGUI::International->new($self->session,'AuthWebGUI'); my $i18n = WebGUI::International->new($self->session,'AuthWebGUI');
my $f = WebGUI::HTMLForm->new($self->session); my $f = WebGUI::HTMLForm->new($self->session);
$f->integer( $f->integer(
-name=>"webguiPasswordLength", -name => "webguiPasswordLength",
-value=>$self->session->setting->get("webguiPasswordLength"), -value => $self->session->setting->get("webguiPasswordLength"),
-label=>$i18n->get(15), -label => $i18n->get(15),
); -hoverHelp => $i18n->get('15 help'),
$f->integer( );
-name => "webguiRequiredDigits", $f->integer(
-label => $i18n->get('setting webguiRequiredDigits'), -name => "webguiRequiredDigits",
-value => $self->session->setting->get("webguiRequiredDigits") -label => $i18n->get('setting webguiRequiredDigits'),
-value => $self->session->setting->get("webguiRequiredDigits"),
-hoverHelp => $i18n->get('setting webguiRequiredDigits help'),
); );
$f->integer( $f->integer(
-name => "webguiNonWordCharacters", -name => "webguiNonWordCharacters",
-label => $i18n->get('setting webguiNonWordCharacters'), -label => $i18n->get('setting webguiNonWordCharacters'),
-value => $self->session->setting->get("webguiNonWordCharacters") -value => $self->session->setting->get("webguiNonWordCharacters"),
-hoverHelp => $i18n->get('setting webguiNonWordCharacters help'),
); );
$f->integer( $f->integer(
-name => "webguiRequiredMixedCase", -name => "webguiRequiredMixedCase",
-label => $i18n->get('setting webguiRequiredMixedCase'), -label => $i18n->get('setting webguiRequiredMixedCase'),
-value => $self->session->setting->get("webguiRequiredMixedCase") -value => $self->session->setting->get("webguiRequiredMixedCase"),
-hoverHelp => $i18n->get('setting webguiRequiredMixedCase help'),
); );
$f->interval( $f->interval(
-name=>"webguiPasswordTimeout", -name => "webguiPasswordTimeout",
-label=>$i18n->get(16), -label => $i18n->get(16),
-value=>$self->session->setting->get("webguiPasswordTimeout") -value => $self->session->setting->get("webguiPasswordTimeout"),
-hoverHelp => $i18n->get('16 help'),
); );
$f->yesNo( $f->yesNo(
-name=>"webguiExpirePasswordOnCreation", -name => "webguiExpirePasswordOnCreation",
-value=>$self->session->setting->get("webguiExpirePasswordOnCreation"), -value => $self->session->setting->get("webguiExpirePasswordOnCreation"),
-label=>$i18n->get(9) -label => $i18n->get(9),
); -hoverHelp => $i18n->get('9 help')
$f->yesNo( );
-name=>"webguiSendWelcomeMessage", $f->yesNo(
-value=>$self->session->setting->get("webguiSendWelcomeMessage"), -name => "webguiSendWelcomeMessage",
-label=>$i18n->get(868,'WebGUI') -value => $self->session->setting->get("webguiSendWelcomeMessage"),
); -label => $i18n->get(868,'WebGUI'),
$f->textarea( -hoverHelp => $i18n->get('868 help','WebGUI'),
-name=>"webguiWelcomeMessage", );
-value=>$self->session->setting->get("webguiWelcomeMessage"), $f->textarea(
-label=>$i18n->get(869,'WebGUI') -name => "webguiWelcomeMessage",
); -value => $self->session->setting->get("webguiWelcomeMessage"),
$f->yesNo( -label => $i18n->get(869,'WebGUI'),
-name=>"webguiChangeUsername", -hoverHelp => $i18n->get('869 help','WebGUI'),
-value=>$self->session->setting->get("webguiChangeUsername"), );
-label=>$i18n->get(19) $f->yesNo(
); -name => "webguiChangeUsername",
$f->yesNo( -value => $self->session->setting->get("webguiChangeUsername"),
-name=>"webguiChangePassword", -label => $i18n->get(19),
-value=>$self->session->setting->get("webguiChangePassword"), -hoverHelp => $i18n->get('19 help'),
-label=>$i18n->get(18) );
); $f->yesNo(
$f->selectList( -name => "webguiChangePassword",
-name => "webguiPasswordRecovery", -value => $self->session->setting->get("webguiChangePassword"),
-value => $self->session->setting->get("webguiPasswordRecovery"), -label => $i18n->get(18),
-label => $i18n->get(6), -hoverHelp => $i18n->get('18 help'),
-hoverHelp => $i18n->get('webguiPasswordRecovery hoverHelp'), );
-options => $self->getPasswordRecoveryTypesAvailable, $f->selectList(
-size => 1, -name => "webguiPasswordRecovery",
-multiple => 0, -value => $self->session->setting->get("webguiPasswordRecovery"),
); -label => $i18n->get(6),
$f->yesNo( -hoverHelp => $i18n->get('webguiPasswordRecovery hoverHelp'),
-name => "webguiPasswordRecoveryRequireUsername", -options => $self->getPasswordRecoveryTypesAvailable,
-value => $self->session->setting->get("webguiPasswordRecoveryRequireUsername"), -size => 1,
-label => $i18n->get('require username for password recovery'), -multiple => 0,
-hoverHelp => $i18n->get('webguiPasswordRecoveryRequireUsername hoverHelp') );
); $f->yesNo(
-name => "webguiPasswordRecoveryRequireUsername",
-value => $self->session->setting->get("webguiPasswordRecoveryRequireUsername"),
-label => $i18n->get('require username for password recovery'),
-hoverHelp => $i18n->get('webguiPasswordRecoveryRequireUsername hoverHelp'),
);
$f->yesNo( $f->yesNo(
-name=>"webguiValidateEmail", -name => "webguiValidateEmail",
-value=>$self->session->setting->get("webguiValidateEmail"), -value => $self->session->setting->get("webguiValidateEmail"),
-label=>$i18n->get('validate email') -label => $i18n->get('validate email'),
); -hoverHelp => $i18n->get('validate email help'),
);
$f->yesNo( $f->yesNo(
-name=>"webguiUseCaptcha", -name => "webguiUseCaptcha",
-value=>$self->session->setting->get("webguiUseCaptcha"), -value => $self->session->setting->get("webguiUseCaptcha"),
-label=>$i18n->get('use captcha') -label => $i18n->get('use captcha'),
); -hoverHelp => $i18n->get('use captcha help'),
);
$f->template( $f->template(
-name=>"webguiAccountTemplate", -name => "webguiAccountTemplate",
-value=>$self->session->setting->get("webguiAccountTemplate"), -value => $self->session->setting->get("webguiAccountTemplate"),
-namespace=>"Auth/WebGUI/Account", -namespace => "Auth/WebGUI/Account",
-label=>$i18n->get("account template") -label => $i18n->get("account template"),
-hoverHelp => $i18n->get("account template help"),
);
$f->template(
-name => "webguiCreateAccountTemplate",
-value => $self->session->setting->get("webguiCreateAccountTemplate"),
-namespace => "Auth/WebGUI/Create",
-label => $i18n->get("create account template"),
-hoverHelp => $i18n->get("create account template help"),
);
$f->template(
-name => "webguiExpiredPasswordTemplate",
-value => $self->session->setting->get("webguiExpiredPasswordTemplate"),
-namespace => "Auth/WebGUI/Expired",
-label => $i18n->get("expired password template"),
-hoverHelp => $i18n->get("expired password template"),
);
$f->template(
-name => "webguiLoginTemplate",
-value => $self->session->setting->get("webguiLoginTemplate"),
-namespace => "Auth/WebGUI/Login",
-label => $i18n->get("login template"),
-hoverHelp => $i18n->get("login template help"),
); );
$f->template( $f->template(
-name=>"webguiCreateAccountTemplate", -name => "webguiPasswordRecoveryTemplate",
-value=>$self->session->setting->get("webguiCreateAccountTemplate"), -value => $self->session->setting->get("webguiPasswordRecoveryTemplate"),
-namespace=>"Auth/WebGUI/Create", -namespace => "Auth/WebGUI/Recovery2",
-label=>$i18n->get("create account template") -label => $i18n->get("password recovery template"),
); -hoverHelp => $i18n->get("password recovery template help")
$f->template( );
-name=>"webguiExpiredPasswordTemplate",
-value=>$self->session->setting->get("webguiExpiredPasswordTemplate"),
-namespace=>"Auth/WebGUI/Expired",
-label=>$i18n->get("expired password template")
);
$f->template(
-name=>"webguiLoginTemplate",
-value=>$self->session->setting->get("webguiLoginTemplate"),
-namespace=>"Auth/WebGUI/Login",
-label=>$i18n->get("login template")
);
$f->template(
-name=>"webguiPasswordRecoveryTemplate",
-value=>$self->session->setting->get("webguiPasswordRecoveryTemplate"),
-namespace=>"Auth/WebGUI/Recovery2",
-label=>$i18n->get("password recovery template")
);
return $f->printRowsOnly; return $f->printRowsOnly;
} }
@ -727,7 +744,7 @@ sub new {
=head2 recoverPassword ( args ) =head2 recoverPassword ( args )
Initiates the password recovery process. Checks for recovery type, Initiates the password recovery process. Checks for recovery type,
and then runs the appropriate method. arguments to this sub are and then runs the appropriate method. Arguments to this sub are
passed directly to the approprate method. passed directly to the approprate method.
=cut =cut
@ -748,54 +765,61 @@ sub recoverPassword {
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 emailRecoverPassword ( $error )
Templated email recovery form.
=head3 $error
$error is any error from the system which needs to be reported to the user.
=cut
sub emailRecoverPassword { sub emailRecoverPassword {
my $self = shift; my $self = shift;
my $error = shift; my $session = $self->session;
my $i18n = WebGUI::International->new($self->session); my $i18n = WebGUI::International->new($session);
my $output my $vars = {};
= "<h1>" . $i18n->get('recover password banner', 'AuthWebGUI') . " </h1> " $vars->{title} = $i18n->get('recover password banner', 'AuthWebGUI');
. "<h3>" . $i18n->get('email recover password start message', 'AuthWebGUI') ."</h3>" $vars->{subtitle} = $i18n->get('email recover password start message', 'AuthWebGUI');
;
$vars->{'recoverFormHeader'} = "\n\n".WebGUI::Form::formHeader($session,{});
$vars->{'recoverFormHidden'} = WebGUI::Form::hidden($session,{"name"=>"op","value"=>"auth"});
$vars->{'recoverFormHidden'} .= WebGUI::Form::hidden($session,{"name"=>"method","value"=>"recoverPasswordFinish"});
$vars->{'recoverFormSubmit'} = WebGUI::Form::submit($session,{});
$vars->{'recoverFormFooter'} = WebGUI::Form::formFooter($session,);
$vars->{'loginUrl'} = $session->url->page('op=auth;method=init');
$vars->{'loginLabel'} = $i18n->get(58);
$vars->{'anonymousRegistrationIsAllowed'} = ($session->setting->get("anonymousRegistration"));
$vars->{'createAccountUrl'} = $session->url->page('op=auth;method=createAccount');
$vars->{'createAccountLabel'} = $i18n->get(67);
$vars->{'recoverMessage'} = $_[0] if ($_[0]);
$vars->{'recoverFormProfile'} = [];
if ( $error ) { ##just one element
$output .= '<p class="error">' . $error . '</p>'; my $emailForm = WebGUI::Form::email($session, {name => "email",});
} my $label = $i18n->get('password recovery email label', 'AuthWebGUI');
push @{$vars->{'recoverFormProfile'}},
{
'id' => 'email',
'formElement' => $emailForm,
'label' => $label,
};
my $f = WebGUI::HTMLForm->new($self->session); $vars->{'recoverFormProfileFieldEmailFormElement'} = $emailForm;
$vars->{'recoverFormProfileFieldEmailLabel'} = $label;
$f->hidden( ##Username is handled by this form
name => 'op', $vars->{'recoverFormUsername'} = WebGUI::Form::text($session, {name => 'username'});
value => 'auth', $vars->{'recoverFormUsernameLabel'} = $i18n->get(50);
);
$f->hidden( return WebGUI::Asset::Template->new($self->session,$self->getPasswordRecoveryTemplateId)->process($vars);
name => "method", }
value => "recoverPasswordFinish",
);
$f->text(
name => "username",
label => $i18n->get('password recovery login label', 'AuthWebGUI'),
hoverHelp => $i18n->get('password recovery login hoverHelp', 'AuthWebGUI'),
uiLevel => 0,
);
$f->email(
name => "email",
label => $i18n->get('password recovery email label', 'AuthWebGUI'),
hoverHelp => $i18n->get('password recovery email hoverHelp', 'AuthWebGUI'),
uiLevel => 0,
);
$f->submit(
uiLevel => 0,
);
$output .= $f->print;
return $output;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -1047,8 +1071,7 @@ sub emailResetPassword {
# do not proceed unless we have an incoming guid from the email, and that guid corresponds to a valid user. # do not proceed unless we have an incoming guid from the email, and that guid corresponds to a valid user.
if(!defined $userId){ if(!defined $userId){
my $i18n = WebGUI::International->new($self->session,"AuthWebGUI"); return $i18n->get("token already used", 'AuthWebGUI');
return $i18n->get("token already used");
} }
# login the user and take them to a page where they can change their password. # login the user and take them to a page where they can change their password.

View file

@ -72,7 +72,8 @@ our $HELP = {
title => 'recovery template title', title => 'recovery template title',
body => '', body => '',
variables => [ variables => [
{ 'name' => 'title', }, { 'name' => 'title', },
{ 'name' => 'subtitle', },
{ 'name' => 'recoverFormHeader', { 'name' => 'recoverFormHeader',
'description' => 'recover.form.header', 'description' => 'recover.form.header',
}, },

View file

@ -11,41 +11,77 @@ our $I18N = {
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'account template' => { 'account template' => {
message => q|Account Template|, message => q|Account Template|,
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'account template help' => {
message => q|Choose a template to style the screen that displays the user's account to them.|,
lastUpdated => 1227210576
},
'create account template' => { 'create account template' => {
message => q|Create Account Template|, message => q|Create Account Template|,
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'create account template help' => {
message => q|Select a template to display the screen where the user creates a user account for this site.|,
lastUpdated => 1078852836,
},
'expired password template' => { 'expired password template' => {
message => q|Expired Password Template|, message => q|Expired Password Template|,
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'expired password template help' => {
message => q|Select a template to display the screen where the user enters a new password after their old one has expired.|,
lastUpdated => 1227210712,
},
'login template' => { 'login template' => {
message => q|Login Template|, message => q|Login Template|,
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'login template help' => {
message => q|Select a template to display the screen where the user can log in. This is different from any of the Macros that also display login forms to the user.|,
lastUpdated => 1227210754,
},
'password recovery template' => { 'password recovery template' => {
message => q|Password Recovery Template|, message => q|Password Recovery Template|,
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'password recovery template help' => {
message => q|Select a template to display the screen where the user can recover a lost password.|,
lastUpdated => 1227210876,
},
'use captcha' => { 'use captcha' => {
message => q|Use captcha image?|, message => q|Use captcha image?|,
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'use captcha help' => {
message => q|If set to yes, the user will be required to enter in text from a captcha as part of making an account.|,
lastUpdated => 1078852836
},
'validate email' => { 'validate email' => {
message => q|Validate email addresses?|, message => q|Validate email addresses?|,
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'validate email help' => {
message => q|Should WebGUI send an email to this person, independently of the welcome message, with a link to start their account? Their account will not be activated until the link is visited, and unvalidated accounts will expire after a configurable timeout. This timeout is set in a workflow.|,
lastUpdated => 1078852836
},
'captcha label' => { 'captcha label' => {
message => q|Verify Your Humanity|, message => q|Verify Your Humanity|,
lastUpdated => 1078852836 lastUpdated => 1078852836
@ -76,6 +112,11 @@ our $I18N = {
lastUpdated => 1078852836 lastUpdated => 1078852836
}, },
'display account template title' => {
message => q|WebGUI Authentication Display Account Template|,
lastUpdated => 1078852836
},
'11' => { '11' => {
message => q|New Password|, message => q|New Password|,
lastUpdated => 1071507924 lastUpdated => 1071507924
@ -131,6 +172,11 @@ our $I18N = {
lastUpdated => 1164335682, lastUpdated => 1164335682,
}, },
'subtitle' => {
message => q|Special instructions for the form. May not be defined in all types of password recovery templates.|,
lastUpdated => 1227216717,
},
'login.message' => { 'login.message' => {
message => q|Any message returned by the system. Usually displays after the form is submitted.|, message => q|Any message returned by the system. Usually displays after the form is submitted.|,
lastUpdated => 1149220294, lastUpdated => 1149220294,
@ -171,6 +217,11 @@ our $I18N = {
lastUpdated => 1076357595 lastUpdated => 1076357595
}, },
'18 help' => {
message => q|Are users allowed to change their own passwords? Note, using this in conjunction with password timeouts can cause a lot of Admin work.|,
lastUpdated => 1076357595,
},
'expired.form.header' => { 'expired.form.header' => {
message => q|The required form elements that go at the top of the password expiration page.|, message => q|The required form elements that go at the top of the password expiration page.|,
lastUpdated => 1149220347, lastUpdated => 1149220347,
@ -236,9 +287,9 @@ our $I18N = {
lastUpdated => 1071885309 lastUpdated => 1071885309
}, },
'13' => { '16 help' => {
message => q|Allow password recovery?|, message => q|The password timeout sets how long a password is good for. After the timeout, the user will be required to enter in a new password.|,
lastUpdated => 1071507940 lastUpdated => 1227208974
}, },
'6' => { '6' => {
@ -271,6 +322,11 @@ our $I18N = {
lastUpdated => 1071507780 lastUpdated => 1071507780
}, },
'9 help' => {
message => q|This will immediately expire a user's password when their account is created.|,
lastUpdated => 1227209117
},
'12' => { '12' => {
message => q|You may not use your old password as your new password|, message => q|You may not use your old password as your new password|,
lastUpdated => 1071507932 lastUpdated => 1071507932
@ -356,6 +412,11 @@ our $I18N = {
lastUpdated => 1071885112 lastUpdated => 1071885112
}, },
'15 help' => {
message => q|The minimum length of passwords that users are required to use, in characters.|,
lastUpdated => 1227208578
},
'8' => { '8' => {
message => q|Your Password Has Expired|, message => q|Your Password Has Expired|,
lastUpdated => 1071507773 lastUpdated => 1071507773
@ -461,6 +522,11 @@ our $I18N = {
lastUpdated => 1076358029 lastUpdated => 1076358029
}, },
'19 help' => {
message => q|Are users allowed to change their username after creating their account?|,
lastUpdated => 1227209885,
},
'10' => { '10' => {
message => q|Old Password|, message => q|Old Password|,
lastUpdated => 1071507875 lastUpdated => 1071507875
@ -527,16 +593,31 @@ our $I18N = {
lastUpdated => 0, lastUpdated => 0,
}, },
'setting webguiRequiredDigits help' => {
message => q{How many digits/numbers are required to be in the user's password?},
lastUpdated => 0,
},
'setting webguiNonWordCharacters' => { 'setting webguiNonWordCharacters' => {
message => q{Number of non-word characters required in password}, message => q{Number of non-word characters required in password},
lastUpdated => 0, lastUpdated => 0,
}, },
'setting webguiNonWordCharacters help' => {
message => q{The number of non-word characters, such as punctuation, are required to be in the user's password.},
lastUpdated => 0,
},
'setting webguiRequiredMixedCase' => { 'setting webguiRequiredMixedCase' => {
message => q{Number of upper-case characters required in password}, message => q{Number of upper-case characters required in password},
lastUpdated => 0, lastUpdated => 0,
}, },
'setting webguiRequiredMixedCase help' => {
message => q{This setting will require that the user have upper-case characters in their password. It will not require that they have lower-case characters},
lastUpdated => 0,
},
'password recovery email label' => { 'password recovery email label' => {
message => q|Email Address|, message => q|Email Address|,
lastUpdated => 1177127324, lastUpdated => 1177127324,

View file

@ -931,6 +931,11 @@ to add or remove users from their groups.
lastUpdated => 1044138691 lastUpdated => 1044138691
}, },
'868 help' => {
message => q|Should the user be sent an email when their account is created?|,
lastUpdated => 1227209376
},
'990' => { '990' => {
message => q|Edit Database Link|, message => q|Edit Database Link|,
lastUpdated => 1056151382 lastUpdated => 1056151382
@ -1125,7 +1130,12 @@ to add or remove users from their groups.
'869' => { '869' => {
message => q|Welcome Message|, message => q|Welcome Message|,
lastUpdated => 1044138730 lastUpdated => 1044138730,
},
'869 help' => {
message => q|This message will be part of the email sent to a user when they create an account on this WebGUI site.|,
lastUpdated => 1227209607,
}, },
'533' => { '533' => {
@ -2985,11 +2995,11 @@ or are under your current version tag.</p>
context => q|Field type name| context => q|Field type name|
}, },
'submit' => { 'submit' => {
message => q|Submit|, message => q|Submit|,
lastUpdated =>1140589512, lastUpdated =>1140589512,
context => q|Field type name and button label| context => q|Field type name and button label|
}, },
'button' => { 'button' => {
message => q|Button|, message => q|Button|,