Display confirmation link expiration date in mail reset template (#378)

This commit is contained in:
Clément Oudot 2011-11-04 10:43:36 +00:00
parent 16129daaeb
commit d903606d88
4 changed files with 39 additions and 4 deletions

View File

@ -28,6 +28,8 @@ $template->param( AUTH_ERROR => $portal->error );
$template->param( AUTH_ERROR_TYPE => $portal->error_type );
$template->param( CHOICE_PARAM => $portal->{authChoiceParam} );
$template->param( CHOICE_VALUE => $portal->{_authChoice} );
$template->param( EXPMAILDATE => $portal->{expMailDate} );
$template->param( EXPMAILTIME => $portal->{expMailTime} );
$template->param(
MAIL => $portal->checkXSSAttack( 'mail', $portal->{mail} )
? ""
@ -52,6 +54,7 @@ if (
$template->param( DISPLAY_FORM => 1 );
$template->param( DISPLAY_RESEND_FORM => 0 );
$template->param( DISPLAY_MAILSENT => 0 );
$template->param( DISPLAY_PASSWORD_FORM => 0 );
}
@ -59,14 +62,25 @@ if (
if ( $portal->{error} == PE_MAILCONFIRMATION_ALREADY_SENT ) {
$template->param( DISPLAY_FORM => 0 );
$template->param( DISPLAY_RESEND_FORM => 1 );
$template->param( DISPLAY_MAILSENT => 0 );
$template->param( DISPLAY_PASSWORD_FORM => 0 );
}
# Display mail sent
if ( $portal->{error} == PE_MAILOK ) {
$template->param( DISPLAY_FORM => 0 );
$template->param( DISPLAY_RESEND_FORM => 0 );
$template->param( DISPLAY_MAILSENT => 1 );
$template->param( DISPLAY_PASSWORD_FORM => 0 );
}
# Display password change form
if ( $portal->{mail_token}
and ( $portal->{error} != PE_MAILERROR and $portal->{error} != PE_MAILOK ) )
{
$template->param( DISPLAY_FORM => 0 );
$template->param( DISPLAY_RESEND_FORM => 0 );
$template->param( DISPLAY_MAILSENT => 0 );
$template->param( DISPLAY_PASSWORD_FORM => 1 );
}

View File

@ -84,6 +84,14 @@
</form>
</TMPL_IF>
<TMPL_IF NAME="DISPLAY_MAILSENT">
<div id="content-all-info">
<lang en="A message has been sent to your mail address." fr="Un message a été envoyé à votre adresse mail." />
<lang en="This message contains a link to reset your password, this link is valid until " fr="Ce message contient un lien pour réinitialiser votre mot de passe, ce lien est valide jusqu'au " />
<TMPL_VAR NAME="EXPMAILDATE">.
</div>
</TMPL_IF>
<div class="panel-buttons">
<button type="button" class="positive" tabindex="1" onclick="location.href='<TMPL_VAR NAME="PORTAL_URL">';return false;">
<lang en="Go to portal" fr="Aller au portail" />

View File

@ -86,6 +86,18 @@
</div>
</TMPL_IF>
<TMPL_IF NAME="DISPLAY_MAILSENT">
<form action="#" method="post" class="login">
<h3>
<lang en="A message has been sent to your mail address." fr="Un message a été envoyé à votre adresse mail." />
</h3>
<p>
<lang en="This message contains a link to reset your password, this link is valid until " fr="Ce message contient un lien pour réinitialiser votre mot de passe, ce lien est valide jusqu'au " />
<TMPL_VAR NAME="EXPMAILDATE">.
</p>
</form>
</TMPL_IF>
<div class="link">
<a href="<TMPL_VAR NAME="PORTAL_URL">">
<lang en="Go back to portal" fr="Retourner au portail" />

View File

@ -253,12 +253,13 @@ sub sendConfirmationMail {
$self->lmLog( "Mail expiration timestamp: $expTimestamp", 'debug' );
my $expMailDate = &POSIX::strftime( "%d/%m/%Y", localtime $expTimestamp );
my $expMailTime = &POSIX::strftime( "%H:%M", localtime $expTimestamp );
$self->{expMailDate} =
&POSIX::strftime( "%d/%m/%Y", localtime $expTimestamp );
$self->{expMailTime} = &POSIX::strftime( "%H:%M", localtime $expTimestamp );
# Replace variables in body
$body =~ s/\$expMailDate/$expMailDate/g;
$body =~ s/\$expMailTime/$expMailTime/g;
$body =~ s/\$expMailDate/$self->{expMailDate}/g;
$body =~ s/\$expMailTime/$self->{expMailTime}/g;
$body =~ s/\$url/$url/g;
$body =~ s/\$(\w+)/decode("utf8",$self->{sessionInfo}->{$1})/ge;