From d98afcc7af571d3cebca9f6eaf68e09d0056bba6 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 20 Nov 2008 21:55:00 +0000 Subject: [PATCH] backporting template email password recovery fix --- ...lt_webgui_password_recovery_template.wgpkg | Bin 0 -> 1151 bytes lib/WebGUI/Auth/WebGUI.pm | 303 ++++++++++-------- lib/WebGUI/Help/AuthWebGUI.pm | 3 +- lib/WebGUI/i18n/English/AuthWebGUI.pm | 87 ++++- lib/WebGUI/i18n/English/WebGUI.pm | 22 +- 5 files changed, 265 insertions(+), 150 deletions(-) create mode 100644 docs/upgrades/packages-7.6.4/default_webgui_password_recovery_template.wgpkg diff --git a/docs/upgrades/packages-7.6.4/default_webgui_password_recovery_template.wgpkg b/docs/upgrades/packages-7.6.4/default_webgui_password_recovery_template.wgpkg new file mode 100644 index 0000000000000000000000000000000000000000..851820423201818db9c3f8beb3aa4e68c8edc0fc GIT binary patch literal 1151 zcmV-_1c3V=iwFP!00000|Ls<7Zz4Ak=JWlE)qbwRzVMPD8i`zz1}Vv<7t(80Dr9!e z;=|Z`wik}8?!R|zFYLmStD1n+5Ag>Uc|0@EJf88)N$vQ{^SpMmS*z)9t6{!=1HR5? zc{N|Ju-Wq4e$DZH&kt)3s2qP~QXv7*B2EdLJ?}4*SjgwaIyhJ+IP?9%(f^akp!Q3@ zq4|GmcTPS_&Rz`{Y_;@#!*}2PH=7NA=l&b*(5pGX=JD6D?*HWY&=29^?{`pyu2fv0 z1iMbh`SY)z%vLIRiiILr>Roe8pQK2ttFI{+3dcPoVi~1IMT;YW5lAjpTFDLFjR2}l z8T)RUjVX~+92Y`{m!AlW`O;{4g+Q(tPbI1P!C#d?HyFhOlvJgB$*_2Wg6+q48@`l7QW(I~|s3d}CX+OS-iL#=gkZr(dR=d;SysO=h7DzaXD2mU!b=Vv- zyGXbgdrFvOg&RaeDM1bHZb9=a27aEWCkNU8{DL)Td#N)iSl#nYi% zMXn(|^Gtrk36b!w>q_p+9;JMVZDkG>oTucxi=3&z6R7Uu0kkcrXPrF>Fki0vE$KSf z5Ks@+G#;>9V){pZC{GBh*f+ZsyLPbEwoSO*I`9JSiU*yrDHcS5xog4UJra-)=G8AX z3YbT6-jrR_WS$+<3cIGwzMmqN>}$g2)x3vFHm*M5@h?yPPN%2)TBkFpG(6qw?|4im z1e&$(Jbn(||>I+rt&-g5=cBa;xj z>=3CtrOrzWt#E7l^dtF}3)+nmr<$M43=D3HSqu%P(1V)H2D+QR6mp6Lyp%@!8E!kB zo59^}HCQ5Vc{E#J+15lgh4y(tL8|R;Nr=p8-6f!$1XdOV!KoMetg(Gs4K|oXVwI|gJuVbV z@?q<`>7VsctKYa^hF|bg@=dlsH-9a_5c#;0Fd~^)OP38PVkXsnNn*lZ6J8!v&4aPU ziyt(?vu5k8Rd|G(hJwxEjgpH$dhs9{&&UeR*%uQ0E@z3Wr|9qRz8_*pf3xw%z#9W^ R3><-he*pi#u7v;;004~0GRFV_ literal 0 HcmV?d00001 diff --git a/lib/WebGUI/Auth/WebGUI.pm b/lib/WebGUI/Auth/WebGUI.pm index f5ef9b99f..157a4f5f0 100644 --- a/lib/WebGUI/Auth/WebGUI.pm +++ b/lib/WebGUI/Auth/WebGUI.pm @@ -450,111 +450,128 @@ sub editUserSettingsForm { my $i18n = WebGUI::International->new($self->session,'AuthWebGUI'); my $f = WebGUI::HTMLForm->new($self->session); - $f->integer( - -name=>"webguiPasswordLength", - -value=>$self->session->setting->get("webguiPasswordLength"), - -label=>$i18n->get(15), - ); - $f->integer( - -name => "webguiRequiredDigits", - -label => $i18n->get('setting webguiRequiredDigits'), - -value => $self->session->setting->get("webguiRequiredDigits") + $f->integer( + -name => "webguiPasswordLength", + -value => $self->session->setting->get("webguiPasswordLength"), + -label => $i18n->get(15), + -hoverHelp => $i18n->get('15 help'), + ); + $f->integer( + -name => "webguiRequiredDigits", + -label => $i18n->get('setting webguiRequiredDigits'), + -value => $self->session->setting->get("webguiRequiredDigits"), + -hoverHelp => $i18n->get('setting webguiRequiredDigits help'), ); - $f->integer( - -name => "webguiNonWordCharacters", - -label => $i18n->get('setting webguiNonWordCharacters'), - -value => $self->session->setting->get("webguiNonWordCharacters") + $f->integer( + -name => "webguiNonWordCharacters", + -label => $i18n->get('setting webguiNonWordCharacters'), + -value => $self->session->setting->get("webguiNonWordCharacters"), + -hoverHelp => $i18n->get('setting webguiNonWordCharacters help'), ); - $f->integer( - -name => "webguiRequiredMixedCase", - -label => $i18n->get('setting webguiRequiredMixedCase'), - -value => $self->session->setting->get("webguiRequiredMixedCase") + $f->integer( + -name => "webguiRequiredMixedCase", + -label => $i18n->get('setting webguiRequiredMixedCase'), + -value => $self->session->setting->get("webguiRequiredMixedCase"), + -hoverHelp => $i18n->get('setting webguiRequiredMixedCase help'), ); - $f->interval( - -name=>"webguiPasswordTimeout", - -label=>$i18n->get(16), - -value=>$self->session->setting->get("webguiPasswordTimeout") + $f->interval( + -name => "webguiPasswordTimeout", + -label => $i18n->get(16), + -value => $self->session->setting->get("webguiPasswordTimeout"), + -hoverHelp => $i18n->get('16 help'), ); - $f->yesNo( - -name=>"webguiExpirePasswordOnCreation", - -value=>$self->session->setting->get("webguiExpirePasswordOnCreation"), - -label=>$i18n->get(9) - ); - $f->yesNo( - -name=>"webguiSendWelcomeMessage", - -value=>$self->session->setting->get("webguiSendWelcomeMessage"), - -label=>$i18n->get(868,'WebGUI') - ); - $f->textarea( - -name=>"webguiWelcomeMessage", - -value=>$self->session->setting->get("webguiWelcomeMessage"), - -label=>$i18n->get(869,'WebGUI') - ); - $f->yesNo( - -name=>"webguiChangeUsername", - -value=>$self->session->setting->get("webguiChangeUsername"), - -label=>$i18n->get(19) - ); - $f->yesNo( - -name=>"webguiChangePassword", - -value=>$self->session->setting->get("webguiChangePassword"), - -label=>$i18n->get(18) - ); - $f->selectList( - -name => "webguiPasswordRecovery", - -value => $self->session->setting->get("webguiPasswordRecovery"), - -label => $i18n->get(6), - -hoverHelp => $i18n->get('webguiPasswordRecovery hoverHelp'), - -options => $self->getPasswordRecoveryTypesAvailable, - -size => 1, - -multiple => 0, - ); - $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( + -name => "webguiExpirePasswordOnCreation", + -value => $self->session->setting->get("webguiExpirePasswordOnCreation"), + -label => $i18n->get(9), + -hoverHelp => $i18n->get('9 help') + ); + $f->yesNo( + -name => "webguiSendWelcomeMessage", + -value => $self->session->setting->get("webguiSendWelcomeMessage"), + -label => $i18n->get(868,'WebGUI'), + -hoverHelp => $i18n->get('868 help','WebGUI'), + ); + $f->textarea( + -name => "webguiWelcomeMessage", + -value => $self->session->setting->get("webguiWelcomeMessage"), + -label => $i18n->get(869,'WebGUI'), + -hoverHelp => $i18n->get('869 help','WebGUI'), + ); + $f->yesNo( + -name => "webguiChangeUsername", + -value => $self->session->setting->get("webguiChangeUsername"), + -label => $i18n->get(19), + -hoverHelp => $i18n->get('19 help'), + ); + $f->yesNo( + -name => "webguiChangePassword", + -value => $self->session->setting->get("webguiChangePassword"), + -label => $i18n->get(18), + -hoverHelp => $i18n->get('18 help'), + ); + $f->selectList( + -name => "webguiPasswordRecovery", + -value => $self->session->setting->get("webguiPasswordRecovery"), + -label => $i18n->get(6), + -hoverHelp => $i18n->get('webguiPasswordRecovery hoverHelp'), + -options => $self->getPasswordRecoveryTypesAvailable, + -size => 1, + -multiple => 0, + ); + $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( - -name=>"webguiValidateEmail", - -value=>$self->session->setting->get("webguiValidateEmail"), - -label=>$i18n->get('validate email') - ); + -name => "webguiValidateEmail", + -value => $self->session->setting->get("webguiValidateEmail"), + -label => $i18n->get('validate email'), + -hoverHelp => $i18n->get('validate email help'), + ); $f->yesNo( - -name=>"webguiUseCaptcha", - -value=>$self->session->setting->get("webguiUseCaptcha"), - -label=>$i18n->get('use captcha') - ); + -name => "webguiUseCaptcha", + -value => $self->session->setting->get("webguiUseCaptcha"), + -label => $i18n->get('use captcha'), + -hoverHelp => $i18n->get('use captcha help'), + ); $f->template( - -name=>"webguiAccountTemplate", - -value=>$self->session->setting->get("webguiAccountTemplate"), - -namespace=>"Auth/WebGUI/Account", - -label=>$i18n->get("account template") + -name => "webguiAccountTemplate", + -value => $self->session->setting->get("webguiAccountTemplate"), + -namespace => "Auth/WebGUI/Account", + -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( - -name=>"webguiCreateAccountTemplate", - -value=>$self->session->setting->get("webguiCreateAccountTemplate"), - -namespace=>"Auth/WebGUI/Create", - -label=>$i18n->get("create account template") - ); - $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") - ); + -name => "webguiPasswordRecoveryTemplate", + -value => $self->session->setting->get("webguiPasswordRecoveryTemplate"), + -namespace => "Auth/WebGUI/Recovery2", + -label => $i18n->get("password recovery template"), + -hoverHelp => $i18n->get("password recovery template help") + ); return $f->printRowsOnly; } @@ -727,7 +744,7 @@ sub new { =head2 recoverPassword ( args ) 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. =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 { my $self = shift; - my $error = shift; - my $i18n = WebGUI::International->new($self->session); + my $session = $self->session; + my $i18n = WebGUI::International->new($session); - my $output - = "

" . $i18n->get('recover password banner', 'AuthWebGUI') . "

" - . "

" . $i18n->get('email recover password start message', 'AuthWebGUI') ."

" - ; + my $vars = {}; + $vars->{title} = $i18n->get('recover password banner', 'AuthWebGUI'); + $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 ) { - $output .= '

' . $error . '

'; - } + ##just one element + 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( - name => 'op', - value => 'auth', - ); + ##Username is handled by this form + $vars->{'recoverFormUsername'} = WebGUI::Form::text($session, {name => 'username'}); + $vars->{'recoverFormUsernameLabel'} = $i18n->get(50); - $f->hidden( - 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; - } + return WebGUI::Asset::Template->new($self->session,$self->getPasswordRecoveryTemplateId)->process($vars); +} #------------------------------------------------------------------- @@ -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. if(!defined $userId){ - my $i18n = WebGUI::International->new($self->session,"AuthWebGUI"); - return $i18n->get("token already used"); + return $i18n->get("token already used", 'AuthWebGUI'); } # login the user and take them to a page where they can change their password. diff --git a/lib/WebGUI/Help/AuthWebGUI.pm b/lib/WebGUI/Help/AuthWebGUI.pm index 77010965a..5e6c1674c 100644 --- a/lib/WebGUI/Help/AuthWebGUI.pm +++ b/lib/WebGUI/Help/AuthWebGUI.pm @@ -72,7 +72,8 @@ our $HELP = { title => 'recovery template title', body => '', variables => [ - { 'name' => 'title', }, + { 'name' => 'title', }, + { 'name' => 'subtitle', }, { 'name' => 'recoverFormHeader', 'description' => 'recover.form.header', }, diff --git a/lib/WebGUI/i18n/English/AuthWebGUI.pm b/lib/WebGUI/i18n/English/AuthWebGUI.pm index d1f72bee0..27b9d39ab 100644 --- a/lib/WebGUI/i18n/English/AuthWebGUI.pm +++ b/lib/WebGUI/i18n/English/AuthWebGUI.pm @@ -11,41 +11,77 @@ our $I18N = { lastUpdated => 1078852836 }, + 'account template' => { message => q|Account Template|, 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' => { message => q|Create Account Template|, 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' => { message => q|Expired Password Template|, 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' => { message => q|Login Template|, 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' => { message => q|Password Recovery Template|, 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' => { message => q|Use captcha image?|, 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' => { message => q|Validate email addresses?|, 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' => { message => q|Verify Your Humanity|, lastUpdated => 1078852836 @@ -76,6 +112,11 @@ our $I18N = { lastUpdated => 1078852836 }, + 'display account template title' => { + message => q|WebGUI Authentication Display Account Template|, + lastUpdated => 1078852836 + }, + '11' => { message => q|New Password|, lastUpdated => 1071507924 @@ -131,6 +172,11 @@ our $I18N = { 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' => { message => q|Any message returned by the system. Usually displays after the form is submitted.|, lastUpdated => 1149220294, @@ -171,6 +217,11 @@ our $I18N = { 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' => { message => q|The required form elements that go at the top of the password expiration page.|, lastUpdated => 1149220347, @@ -236,9 +287,9 @@ our $I18N = { lastUpdated => 1071885309 }, - '13' => { - message => q|Allow password recovery?|, - lastUpdated => 1071507940 + '16 help' => { + 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 => 1227208974 }, '6' => { @@ -271,6 +322,11 @@ our $I18N = { lastUpdated => 1071507780 }, + '9 help' => { + message => q|This will immediately expire a user's password when their account is created.|, + lastUpdated => 1227209117 + }, + '12' => { message => q|You may not use your old password as your new password|, lastUpdated => 1071507932 @@ -356,6 +412,11 @@ our $I18N = { lastUpdated => 1071885112 }, + '15 help' => { + message => q|The minimum length of passwords that users are required to use, in characters.|, + lastUpdated => 1227208578 + }, + '8' => { message => q|Your Password Has Expired|, lastUpdated => 1071507773 @@ -461,6 +522,11 @@ our $I18N = { lastUpdated => 1076358029 }, + '19 help' => { + message => q|Are users allowed to change their username after creating their account?|, + lastUpdated => 1227209885, + }, + '10' => { message => q|Old Password|, lastUpdated => 1071507875 @@ -527,16 +593,31 @@ our $I18N = { lastUpdated => 0, }, + 'setting webguiRequiredDigits help' => { + message => q{How many digits/numbers are required to be in the user's password?}, + lastUpdated => 0, + }, + 'setting webguiNonWordCharacters' => { message => q{Number of non-word characters required in password}, 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' => { message => q{Number of upper-case characters required in password}, 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' => { message => q|Email Address|, lastUpdated => 1177127324, diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index bcdfcfc1a..2a623afa6 100755 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -931,6 +931,11 @@ to add or remove users from their groups. lastUpdated => 1044138691 }, + '868 help' => { + message => q|Should the user be sent an email when their account is created?|, + lastUpdated => 1227209376 + }, + '990' => { message => q|Edit Database Link|, lastUpdated => 1056151382 @@ -1125,7 +1130,12 @@ to add or remove users from their groups. '869' => { 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' => { @@ -2985,11 +2995,11 @@ or are under your current version tag.

context => q|Field type name| }, - 'submit' => { - message => q|Submit|, - lastUpdated =>1140589512, - context => q|Field type name and button label| - }, + 'submit' => { + message => q|Submit|, + lastUpdated =>1140589512, + context => q|Field type name and button label| + }, 'button' => { message => q|Button|,