This commit is contained in:
Christophe Maudoux 2020-01-04 16:30:22 +01:00
parent 7adbf66d99
commit b029fdf604
18 changed files with 48 additions and 52 deletions

View File

@ -442,7 +442,7 @@ site/templates/common/mail/tr.json
site/templates/common/mail/vi.json
site/templates/common/mail/zh_CN.json
site/templates/common/mail_2fcode.tpl
site/templates/common/mail_certificatReset.tpl
site/templates/common/mail_certificateReset.tpl
site/templates/common/mail_confirm.tpl
site/templates/common/mail_footer.tpl
site/templates/common/mail_header.tpl

View File

@ -11,17 +11,11 @@ use Lemonldap::NG::Portal::Main::Constants qw(
extends 'Lemonldap::NG::Portal::Lib::LDAP';
our $VERSION = '2.0.7';
our $VERSION = '2.0.8';
# RUNNING METHODS
# PRIVATE METHODS
# PRIVATE METHOD
sub modifCertificate {
my $self = shift;
my $newcertif = shift;
my $usercertif = shift;
my $req = shift;
my ( $self, $newcertif, $usercertif, $req ) = @_;
my $ceaAttribute = $self->conf->{certificateResetByMailCeaAttribute}
|| "description";
my $certificateAttribute =
@ -29,8 +23,6 @@ sub modifCertificate {
|| "userCertificate;binary";
# Set the dn unless done before
#
#
my $dn;
if ( $req->userData->{_dn} ) {
$dn = $req->userData->{_dn};
@ -41,7 +33,7 @@ sub modifCertificate {
$self->logger->debug("Get DN from session data: $dn");
}
unless ($dn) {
$self->logger->error('"dn" is not set, aborting password modification');
$self->logger->error('"dn" is not set, aborting certificate reset');
return PE_ERROR;
}

View File

@ -262,8 +262,7 @@ sub _certificateReset {
my $mailSession = $self->getCertificateSession( $req->{user} );
unless ( $mailSession or $mailToken ) {
# Create a new session
## Create a new session
my $infos = {};
# Set _utime for session autoremove
@ -425,7 +424,7 @@ sub modifyCertificate {
my $x509;
my $notAfter;
$self->logger->debug('Change your Certificate form response');
$self->logger->debug('Change your certificate form response');
if ( my $token = $req->param('token') ) {
$req->sessionInfo( $self->ott->getToken($token) );
@ -453,10 +452,9 @@ sub modifyCertificate {
#Updload certificate
my $upload = $req->uploads->{certif};
unless ( $upload->size > 0 ) { return PE_RESETCERTIFICATE_FORMEMPTY; }
# Get Certificate
return PE_RESETCERTIFICATE_FORMEMPTY unless ( $upload->size > 0 );
# Get certificate
my $file = $upload->path;
$self->userLogger->debug( "Temporaly file " . $file );
@ -474,11 +472,9 @@ sub modifyCertificate {
unless ($x509) {
$self->userLogger->debug( "Unable to decode certificate for user "
. Net::SSLeay::ERR_error_string( Net::SSLeay::ERR_get_error() ) );
#return PE_CERTIFICATE_INVALID;
return PE_RESETCERTIFICATE_INVALID;
}
$self->userLogger->debug("Certificate decoded successfully");
$self->userLogger->debug("Certificate successfully decoded");
$notAfter = Net::SSLeay::P_ASN1_TIME_get_isotime(
Net::SSLeay::X509_get_notAfter($x509) );
@ -489,25 +485,22 @@ sub modifyCertificate {
Net::SSLeay::X509_get_serialNumber($x509) );
$self->userLogger->debug(
"Certificate will expire after $notAfter, Issuer $x509issuer and serialNumber $x509serial"
"Certificate will expire after $notAfter, Issuer $x509issuer and serialNumber $x509serial"
);
# Check Certificate Validity before store
# Check certificate validity before store
if (
$self->checkCertificateValidity( $notAfter,
$self->conf->{certificateResetByMailValidityDelay} ) == 0
)
{
$self->userLogger->debug(
"Your cettificate is no longer valid in $self->conf->{certificateValidityDelay}"
"Your certificate is no longer valid in $self->conf->{certificateValidityDelay}"
);
return PE_RESETCERTIFICATE_INVALID;
#return PE_PASSWORD_MISMATCH;
}
# Build serial number hex: example f3:08:52:63:28:29:fa:e2
my @numberstring = split //, lc($x509serial);
my $serial = "";
for ( my $i = 0 ; $i <= $#numberstring ; $i += 2 ) {
@ -516,7 +509,6 @@ sub modifyCertificate {
}
# format issuer in the good format example "CN=CA,OU=CISIRH,O=MINEFI,L=Paris,ST=France,C=FR"
my @issuertab = split /\//, $x509issuer;
shift(@issuertab);
my $issuer = join( ",", reverse(@issuertab) );
@ -530,7 +522,7 @@ sub modifyCertificate {
# Get attribut userCertificate;binary value
my $cert = $self->certificateHash($file);
# modif the ldap certificate attribute
# Modify ldap certificate attribute
$req->user( $req->{sessionInfo}->{_user} );
my $result =
$self->registerModule->modifCertificate( $certificatExactAssertion,
@ -540,7 +532,7 @@ sub modifyCertificate {
# Mail token can be used only one time, delete the session if all is ok
return $result unless ( $result == PE_OK );
# Send mail to notify the certificate reset sucessfully
# Send mail to notify the certificate has been successfully reset
$req->data->{mailAddress} ||=
$self->p->getFirstValue(
$req->{sessionInfo}->{ $self->conf->{mailSessionKey} } );
@ -565,7 +557,7 @@ sub modifyCertificate {
# Use HTML template
$body = $self->loadMailTemplate(
$req,
'mail_certificatReset',
'mail_certificateReset',
filter => $tr,
params => \%tplPrms
);
@ -629,7 +621,7 @@ sub display {
$tplPrm{MAIL_TOKEN} = $req->data->{mailToken};
}
# Display captcha if it's enabled
# Display captcha if enabled
if ( $req->captcha ) {
$tplPrm{CAPTCHA_SRC} = $req->captcha;
$tplPrm{CAPTCHA_SIZE} = $self->conf->{captcha_size};
@ -671,7 +663,7 @@ sub display {
$tplPrm{DISPLAY_MAILSENT} = 1;
}
# Display Certificate Reset form
# Display certificate reset form
elsif ( $req->data->{mailToken}
and $req->error != PE_MAILERROR
and $req->error != PE_BADMAILTOKEN
@ -681,7 +673,7 @@ sub display {
$tplPrm{DISPLAY_CERTIF_FORM} = 1;
}
# Display Certificate Reset form again if certificate invalid
# Display certificate reset form again if certificate invalid
elsif ($req->error == PE_RESETCERTIFICATE_FORMEMPTY
|| $req->error == PE_RESETCERTIFICATE_INVALID )
{
@ -720,7 +712,6 @@ sub getCertificateSession {
}
# Use Certificate Update parameter to send mail
sub sendmail {
my ( $self, $mail, $subject, $body, $html ) = @_;

View File

@ -163,6 +163,7 @@
"gplSoft":"البرمجيات الحرة التي تغطيها رخصة GPL",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"Id",
"imSure":"انا متاكد",
"info":"معلومات",
@ -233,7 +234,7 @@
"removeOtherSessions":"إزالة الجلسات الأخرى",
"resendConfirmMail":"هل تريد إعادة إرسال رسالة التأكيد؟",
"resentConfirm":"هل تريد إعادة إرسال رسالة التأكيد؟",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"إعادة تعيين كلمة المرور الخاصة بي",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":" إعادة تحميل الحقوق تحتاج إلى تسجيل الخروج وتسجيل الدخول مرة أخرى",

View File

@ -163,6 +163,7 @@
"gplSoft":"Freie Software, die von der GPL-Lizenz abgedeckt wird",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"ID",
"imSure":"Ich bin sicher",
"info":"Information",
@ -233,7 +234,7 @@
"removeOtherSessions":"Andere Sitzungen löschen",
"resendConfirmMail":"Bestätigungsmail erneuert senden ?",
"resentConfirm":"Möchtest du, dass die Bestätigungsmail erneut gesendet wird ?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Mein Passwort zurücksetzen",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":"Zum Neuladen der Rechte musst du dich ab- und wieder anmelden",

View File

@ -163,6 +163,7 @@
"gplSoft":"free software covered by the GPL license",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"Id",
"imSure":"I'm sure",
"info":"Information",
@ -233,7 +234,7 @@
"removeOtherSessions":"Remove other sessions",
"resendConfirmMail":"Resend confirmation mail?",
"resentConfirm":"Do you want the confirmation mail to be resent?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Reset my password",
"rest2f":"Verification code",
"rightsReloadNeedsLogout": "Rights reloads need to logout and login again",

View File

@ -163,6 +163,7 @@
"gplSoft":"Software libre cubierto bajo licencia GPL",
"groups_sso":"GRUPOS SSO",
"headers":"ENCABEZADOS",
"hello":"Buesnos dias",
"id":"Id",
"imSure":"Estoy seguro",
"info":"Información",
@ -233,7 +234,7 @@
"removeOtherSessions":"Suprimir las otras sesiones",
"resendConfirmMail":"¿Reenviar e-mail de confirmación?",
"resentConfirm":"¿Desea que el e-mail de confirmación sea reenviado?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Reiniciar mi contraseña",
"rest2f":"Código de verificación",
"rightsReloadNeedsLogout":"La recarga de derechos necesita desconectarse y conectarse de nuevo",

View File

@ -163,6 +163,7 @@
"gplSoft":"free software covered by the GPL license",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"Id",
"imSure":"Olen varma",
"info":"Information",
@ -233,7 +234,7 @@
"removeOtherSessions":"Remove other sessions",
"resendConfirmMail":"Uudelleen lähetä vahvistus sähköposti?",
"resentConfirm":"Do you want the confirmation mail to be resent?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Palauta salasanani?",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",

View File

@ -163,6 +163,7 @@
"gplSoft":"logiciel libre protégé par la licence GPL",
"groups_sso":"GROUPES SSO",
"headers":"ENTETES",
"hello":"Bonjour",
"id":"Id",
"imSure":"Je suis sûr",
"info":"Information",
@ -233,7 +234,7 @@
"removeOtherSessions":"Fermer les autres sessions",
"resendConfirmMail":"Renvoyer le mail de confirmation ?",
"resentConfirm":"Voulez-vous que le message de confirmation soit renvoyé ?",
"resetCertificateOK":"Votre certificat a bien été réinitialisé",
"resetCertificateOK":"Votre certificat a bien été réinitialisé!",
"resetPwd":"Réinitialiser mon mot de passe",
"rest2f":"Code de vérification",
"rightsReloadNeedsLogout": "Le rechargement des droits nécessite une déconnexion",

View File

@ -163,6 +163,7 @@
"gplSoft":"Software libero coperto dalla licenza GPL",
"groups_sso":"GRUPPI SSO",
"headers":"INTESTAZIONI",
"hello":"Buongiorno",
"id":"Id",
"imSure":"Sono sicuro",
"info":"Informazioni",
@ -233,7 +234,7 @@
"removeOtherSessions":"Rimuovere altre sessioni",
"resendConfirmMail":"Inviare nuovamente mail di conferma?",
"resentConfirm":"Vuoi inviare di nuovo la mail di conferma?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Reimpostare la password",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":"Le ricariche dei diritti necessitano di disconnettersi e di riconnettersi",

View File

@ -163,6 +163,7 @@
"gplSoft":"free software covered by the GPL license",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"Id",
"imSure":"I'm sure",
"info":"Information",
@ -233,7 +234,7 @@
"removeOtherSessions":"Remove other sessions",
"resendConfirmMail":"Resend confirmation mail?",
"resentConfirm":"Do you want the confirmation mail to be resent?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Reset my password",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",

View File

@ -163,6 +163,7 @@
"gplSoft":"free software covered by the GPL license",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"Id",
"imSure":"I'm sure",
"info":"Information",
@ -233,7 +234,7 @@
"removeOtherSessions":"Remove other sessions",
"resendConfirmMail":"Resend confirmation mail?",
"resentConfirm":"Do you want the confirmation mail to be resent?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Reset my password",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",

View File

@ -163,6 +163,7 @@
"gplSoft":"free software covered by the GPL license",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"Id",
"imSure":"I'm sure",
"info":"Information",
@ -233,7 +234,7 @@
"removeOtherSessions":"Remove other sessions",
"resendConfirmMail":"Resend confirmation mail?",
"resentConfirm":"Do you want the confirmation mail to be resent?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Reset my password",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",

View File

@ -163,6 +163,7 @@
"gplSoft":"GPL lisansı kapsamında özgür yazılım",
"groups_sso":"TOA GRUPLARI",
"headers":"BAŞLIKLAR",
"hello":"Hello",
"id":"ID",
"imSure":"Eminim",
"info":"Bilgi",
@ -233,7 +234,7 @@
"removeOtherSessions":"Diğer oturumları sil",
"resendConfirmMail":"Doğrulama e-postasını tekrar gönder?",
"resentConfirm":"Onay e-postasının tekrar gönderilmesini ister misiniz?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Parolamı sıfırla",
"rest2f":"Doğrulama kodu",
"rightsReloadNeedsLogout":"Yetkiler yeniden yüklendiğinde çıkış yapıp tekrar giriş yapmanız gerekir",

View File

@ -163,6 +163,7 @@
"gplSoft":"phần mềm tự do được cấp phép bởi GPL",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"Id",
"imSure":"Tôi chắc chắn",
"info":"Thông tin",
@ -233,7 +234,7 @@
"removeOtherSessions":"Xóa các phiên khác",
"resendConfirmMail":"Gửi lại thư xác nhận?",
"resentConfirm":"Bạn có muốn gửi lại thư xác nhận không?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"Đặt lại mật khẩu của tôi",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":"Tải lại quyền cần đăng xuất và đăng nhập lại",

View File

@ -163,6 +163,7 @@
"gplSoft":"受GPL协议保护的自由软件",
"groups_sso":"SSO GROUPS",
"headers":"HEADERS",
"hello":"Hello",
"id":"Id",
"imSure":"我确认",
"info":"信息",
@ -233,7 +234,7 @@
"removeOtherSessions":"移除其他会话",
"resendConfirmMail":"重新发送确认邮件?",
"resentConfirm":"您想确认邮件被重新发送吗?",
"resetCertificateOK":"Your certificate has been successfully reset",
"resetCertificateOK":"Your certificate has been successfully reset!",
"resetPwd":"重置我的密码",
"rest2f":"Verification code",
"rightsReloadNeedsLogout":"重新加载权限需要登出并且再次登录",

View File

@ -3,7 +3,7 @@
<p>
<span trspan="hello">Hello</span> $cn,<br />
<br />
<span trspan="certificatReset">Your certificate was reset sucessfully.</span>
<span trspan="resetCertificateOK">Your certificate has been successfully reset!</span>
</p>
<TMPL_INCLUDE NAME="mail_footer.tpl">

View File

@ -52,7 +52,7 @@ SKIP: {
certificateResetByMailStep1Body =>
'Click here <a href="$url"> to confirm your mail. It will expire $expMailDate',
certificateResetByMailStep2Body =>
'Certificate Reset sucessfully!',
'Certificate successfully reset!',
certificateValidityDelay => 30
}
@ -215,7 +215,7 @@ lkRrWfQftwmLyNIu3HfSgXlgAZS30ymfbzBU
}
);
ok( mail() =~ /Certificate Reset sucessfully/, 'Certificate was changed' );
ok( mail() =~ /Certificate successfully reset/, 'Certificate has been reset' );