Dissociate confirm mail sent and norman mail sent error case in mail reset (#377)

This commit is contained in:
Clément Oudot 2011-11-04 16:34:16 +00:00
parent 9b97d72584
commit f56dcedfa0
7 changed files with 55 additions and 20 deletions

View File

@ -89,6 +89,7 @@ sub portalTab {
69 => 'PORTAL_MAILFIRSTACCESS',
70 => 'PORTAL_MAILNOTFOUND',
71 => 'PORTAL_PASSWORDFIRSTACCESS',
72 => 'PORTAL_MAILCONFIRMOK',
};
}

View File

@ -58,36 +58,49 @@ if (
)
{
$template->param( DISPLAY_FORM => 1 );
$template->param( DISPLAY_RESEND_FORM => 0 );
$template->param( DISPLAY_MAILSENT => 0 );
$template->param( DISPLAY_PASSWORD_FORM => 0 );
$template->param( DISPLAY_FORM => 1 );
$template->param( DISPLAY_RESEND_FORM => 0 );
$template->param( DISPLAY_CONFIRMMAILSENT => 0 );
$template->param( DISPLAY_MAILSENT => 0 );
$template->param( DISPLAY_PASSWORD_FORM => 0 );
}
# Display mail confirmation resent form
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 );
$template->param( DISPLAY_FORM => 0 );
$template->param( DISPLAY_RESEND_FORM => 1 );
$template->param( DISPLAY_CONFIRMMAILSENT => 0 );
$template->param( DISPLAY_MAILSENT => 0 );
$template->param( DISPLAY_PASSWORD_FORM => 0 );
}
# Display confirmation mail sent
if ( $portal->{error} == PE_MAILCONFIRMOK ) {
$template->param( DISPLAY_FORM => 0 );
$template->param( DISPLAY_RESEND_FORM => 0 );
$template->param( DISPLAY_CONFIRMMAILSENT => 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 );
$template->param( DISPLAY_FORM => 0 );
$template->param( DISPLAY_RESEND_FORM => 0 );
$template->param( DISPLAY_CONFIRMMAILSENT => 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 );
$template->param( DISPLAY_FORM => 0 );
$template->param( DISPLAY_RESEND_FORM => 0 );
$template->param( DISPLAY_CONFIRMMAILSENT => 0 );
$template->param( DISPLAY_MAILSENT => 0 );
$template->param( DISPLAY_PASSWORD_FORM => 1 );
}
print $portal->header('text/html; charset=utf8');

View File

@ -89,7 +89,7 @@
</form>
</TMPL_IF>
<TMPL_IF NAME="DISPLAY_MAILSENT">
<TMPL_IF NAME="DISPLAY_CONFIRMMAILSENT">
<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 " />
@ -97,6 +97,12 @@
</div>
</TMPL_IF>
<TMPL_IF NAME="DISPLAY_MAILSENT">
<div id="content-all-info">
<lang en="Your new password has been sent to your mail address." fr="Votre nouveau mot de passe a été envoyé à votre adresse mail." />
</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

@ -93,7 +93,7 @@
</div>
</TMPL_IF>
<TMPL_IF NAME="DISPLAY_MAILSENT">
<TMPL_IF NAME="DISPLAY_CONFIRMMAILSENT">
<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." />
@ -105,6 +105,14 @@
</form>
</TMPL_IF>
<TMPL_IF NAME="DISPLAY_MAILSENT">
<form action="#" method="post" class="login">
<h3>
<lang en="Your new password has been sent to your mail address." fr="Votre nouveau mot de passe a été envoyé à votre adresse mail." />
</h3>
</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

@ -58,6 +58,7 @@ sub process {
(
$self->{error} <= 0
or $self->{error} == PE_PASSWORD_OK
or $self->{error} == PE_MAILCONFIRMOK
or $self->{error} == PE_MAILOK
) ? 0 : 1
);
@ -283,7 +284,7 @@ sub sendConfirmationMail {
return PE_MAILERROR
unless $self->send_mail( $self->{mailAddress}, $subject, $body, $html );
PE_MAILOK;
PE_MAILCONFIRMOK;
}
## @method int changePassword

View File

@ -141,6 +141,7 @@ use constant {
PE_MAILFIRSTACCESS => 69,
PE_MAILNOTFOUND => 70,
PE_PASSWORDFIRSTACCESS => 71,
PE_MAILCONFIRMOK => 72,
# Portal messages
PM_USER => 0,
@ -185,7 +186,7 @@ our @EXPORT = qw( PE_IMG_NOK PE_IMG_OK PE_INFO PE_REDIRECT PE_DONE PE_OK
PE_SAML_LOAD_SP_ERROR PE_SAML_ATTR_ERROR PE_OPENID_EMPTY PE_OPENID_BADID
PE_MISSINGREQATTR PE_BADPARTNER PE_MAILCONFIRMATION_ALREADY_SENT
PE_PASSWORDFORMEMPTY PE_CAS_SERVICE_NOT_ALLOWED PE_MAILFIRSTACCESS
PE_MAILNOTFOUND PE_PASSWORDFIRSTACCESS
PE_MAILNOTFOUND PE_PASSWORDFIRSTACCESS PE_MAILCONFIRMOK
PM_USER PM_DATE PM_IP PM_SESSIONS_DELETED PM_OTHER_SESSIONS
PM_REMOVE_OTHER_SESSIONS PM_PP_GRACE PM_PP_EXP_WARNING
PM_SAML_IDPSELECT PM_SAML_IDPCHOOSEN PM_REMEMBERCHOICE PM_SAML_SPLOGOUT
@ -801,6 +802,7 @@ sub error_type {
PE_OK, PE_PASSWORD_OK,
PE_MAILOK, PE_LOGOUT_OK,
PE_MAILFIRSTACCESS, PE_PASSWORDFIRSTACCESS,
PE_MAILCONFIRMOK,
)
)
);

View File

@ -131,6 +131,7 @@ __END__
# * PE_MAILFIRSTACCESS 69
# * PE_MAILNOTFOUND 70
# * PE_PASSWORDFIRSTACCESS 71
# * PE_MAILCONFIRMOK 72
# Not used in errors:
# * PE_DONE -1
@ -214,6 +215,7 @@ sub error_fr {
'Merci de saisir votre adresse mail',
'Pas d\'utilisateur correspondant',
'Merci de saisir votre nouveau mot de passe',
'Un mail de confirmation vous a été envoyé',
];
}
@ -294,6 +296,7 @@ sub error_en {
'Please provide your mail address',
'No matching user',
'Please provide your new password',
'A confirmation mail has been sent',
];
}
@ -375,6 +378,7 @@ sub error_ro {
'Vă rugăm să introduceţi adresa dvs. de e-mail',
'No matching user',
'Please provide your new password',
'Un e-mail a fost trimis',
];
}