Specific mail user not found error for mail reset (#377)

This commit is contained in:
Clément Oudot 2011-10-28 15:52:19 +00:00
parent 56bda5574e
commit 16129daaeb
5 changed files with 28 additions and 4 deletions

View File

@ -87,6 +87,7 @@ sub portalTab {
67 => 'PORTAL_PASSWORDFORMEMPTY', 67 => 'PORTAL_PASSWORDFORMEMPTY',
68 => 'PORTAL_CAS_SERVICE_NOT_ALLOWED', 68 => 'PORTAL_CAS_SERVICE_NOT_ALLOWED',
69 => 'PORTAL_MAILFIRSTACCESS', 69 => 'PORTAL_MAILFIRSTACCESS',
70 => 'PORTAL_MAILNOTFOUND',
}; };
} }

View File

@ -44,7 +44,7 @@ if (
( (
$portal->{error} == PE_MAILFORMEMPTY $portal->{error} == PE_MAILFORMEMPTY
or $portal->{error} == PE_MAILFIRSTACCESS or $portal->{error} == PE_MAILFIRSTACCESS
or $portal->{error} == PE_BADCREDENTIALS or $portal->{error} == PE_MAILNOTFOUND
) )
and !$portal->{mail_token} and !$portal->{mail_token}
) )

View File

@ -27,6 +27,7 @@ use POSIX;
# - itself: # - itself:
# - smtpInit # - smtpInit
# - extractMailInfo # - extractMailInfo
# - getMailUser
# - storeMailSession # - storeMailSession
# - sendConfirmationMail # - sendConfirmationMail
# - changePassword # - changePassword
@ -37,7 +38,6 @@ use POSIX;
# - setGroups # - setGroups
# - userDB module: # - userDB module:
# - userDBInit # - userDBInit
# - getUser
# - setSessionInfo # - setSessionInfo
# - passwordDB module: # - passwordDB module:
# - passwordDBInit # - passwordDBInit
@ -50,7 +50,7 @@ sub process {
$self->{error} = $self->_subProcess( $self->{error} = $self->_subProcess(
qw(smtpInit userDBInit passwordDBInit extractMailInfo qw(smtpInit userDBInit passwordDBInit extractMailInfo
getUser setSessionInfo setMacros setLocalGroups setGroups setPersistentSessionInfo getMailUser setSessionInfo setMacros setLocalGroups setGroups setPersistentSessionInfo
storeMailSession sendConfirmationMail changePassword sendPasswordMail) storeMailSession sendConfirmationMail changePassword sendPasswordMail)
); );
@ -124,6 +124,21 @@ sub extractMailInfo {
PE_OK; PE_OK;
} }
## @method int getMailUser
# Search for user using UserDB module
# @return Lemonldap::NG::Portal constant
sub getMailUser {
my ($self) = splice @_;
my $error = $self->getUser();
if ( $error == PE_USERNOTFOUND or $error == PE_BADCREDENTIALS ) {
return PE_MAILNOTFOUND;
}
return $error;
}
## @method int storeMailSession ## @method int storeMailSession
# Create mail session and store token # Create mail session and store token
# @return Lemonldap::NG::Portal constant # @return Lemonldap::NG::Portal constant

View File

@ -139,6 +139,7 @@ use constant {
PE_PASSWORDFORMEMPTY => 67, PE_PASSWORDFORMEMPTY => 67,
PE_CAS_SERVICE_NOT_ALLOWED => 68, PE_CAS_SERVICE_NOT_ALLOWED => 68,
PE_MAILFIRSTACCESS => 69, PE_MAILFIRSTACCESS => 69,
PE_MAILNOTFOUND => 70,
# Portal messages # Portal messages
PM_USER => 0, PM_USER => 0,
@ -183,6 +184,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_SAML_LOAD_SP_ERROR PE_SAML_ATTR_ERROR PE_OPENID_EMPTY PE_OPENID_BADID
PE_MISSINGREQATTR PE_BADPARTNER PE_MAILCONFIRMATION_ALREADY_SENT PE_MISSINGREQATTR PE_BADPARTNER PE_MAILCONFIRMATION_ALREADY_SENT
PE_PASSWORDFORMEMPTY PE_CAS_SERVICE_NOT_ALLOWED PE_MAILFIRSTACCESS PE_PASSWORDFORMEMPTY PE_CAS_SERVICE_NOT_ALLOWED PE_MAILFIRSTACCESS
PE_MAILNOTFOUND
PM_USER PM_DATE PM_IP PM_SESSIONS_DELETED PM_OTHER_SESSIONS PM_USER PM_DATE PM_IP PM_SESSIONS_DELETED PM_OTHER_SESSIONS
PM_REMOVE_OTHER_SESSIONS PM_PP_GRACE PM_PP_EXP_WARNING PM_REMOVE_OTHER_SESSIONS PM_PP_GRACE PM_PP_EXP_WARNING
PM_SAML_IDPSELECT PM_SAML_IDPCHOOSEN PM_REMEMBERCHOICE PM_SAML_SPLOGOUT PM_SAML_IDPSELECT PM_SAML_IDPCHOOSEN PM_REMEMBERCHOICE PM_SAML_SPLOGOUT
@ -794,8 +796,10 @@ sub error_type {
if ( if (
scalar( scalar(
grep { /^$code$/ } ( grep { /^$code$/ } (
PE_REDIRECT, PE_DONE, PE_OK, PE_PASSWORD_OK, PE_REDIRECT, PE_DONE,
PE_OK, PE_PASSWORD_OK,
PE_MAILOK, PE_LOGOUT_OK, PE_MAILOK, PE_LOGOUT_OK,
PE_MAILFIRSTACCESS,
) )
) )
); );

View File

@ -129,6 +129,7 @@ __END__
# * PE_PASSWORDFORMEMPTY 67 # * PE_PASSWORDFORMEMPTY 67
# * PE_CAS_SERVICE_NOT_ALLOWED 68 # * PE_CAS_SERVICE_NOT_ALLOWED 68
# * PE_MAILFIRSTACCESS 69 # * PE_MAILFIRSTACCESS 69
# * PE_MAILNOTFOUND 70
# Not used in errors: # Not used in errors:
# * PE_DONE -1 # * PE_DONE -1
@ -210,6 +211,7 @@ sub error_fr {
'Mot de passe non renseigné', 'Mot de passe non renseigné',
'Accès non autorisé au service CAS', 'Accès non autorisé au service CAS',
'Merci de saisir votre adresse mail', 'Merci de saisir votre adresse mail',
'Pas d\'utilisateur correspondant',
]; ];
} }
@ -288,6 +290,7 @@ sub error_en {
'Password field must be filled', 'Password field must be filled',
'Access non granted on CAS service', 'Access non granted on CAS service',
'Please provide your mail address', 'Please provide your mail address',
'No matching user',
]; ];
} }
@ -367,6 +370,7 @@ sub error_ro {
'Password field must be filled', 'Password field must be filled',
'Access non granted on CAS service', 'Access non granted on CAS service',
'Vă rugăm să introduceţi adresa dvs. de e-mail', 'Vă rugăm să introduceţi adresa dvs. de e-mail',
'No matching user',
]; ];
} }