Commit 3dd86848 authored by Xavier Guimard's avatar Xavier Guimard

Translation for mails (#595)

parent 87bb55cb
......@@ -2,7 +2,6 @@
* write REST method to create session with an id
* remove cache on handler init()
* public\_page
* Uniq session plugins
* Test ForceAuth
* Calendar in notifications explorer
* login history
......
......@@ -49,6 +49,7 @@ lib/Lemonldap/NG/Portal/Lib/OneTimeToken.pm
lib/Lemonldap/NG/Portal/Lib/OpenID/Server.pm
lib/Lemonldap/NG/Portal/Lib/OpenID/SREG.pm
lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm
lib/Lemonldap/NG/Portal/Lib/OtherSessions.pm
lib/Lemonldap/NG/Portal/Lib/Remote.pm
lib/Lemonldap/NG/Portal/Lib/RESTProxy.pm
lib/Lemonldap/NG/Portal/Lib/SAML.pm
......@@ -75,10 +76,13 @@ lib/Lemonldap/NG/Portal/Password/Demo.pm
lib/Lemonldap/NG/Portal/Password/LDAP.pm
lib/Lemonldap/NG/Portal/Plugins/CDA.pm
lib/Lemonldap/NG/Portal/Plugins/ForceAuth.pm
lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm
lib/Lemonldap/NG/Portal/Plugins/History.pm
lib/Lemonldap/NG/Portal/Plugins/MailReset.pm
lib/Lemonldap/NG/Portal/Plugins/Notifications.pm
lib/Lemonldap/NG/Portal/Plugins/Register.pm
lib/Lemonldap/NG/Portal/Plugins/RESTServer.pm
lib/Lemonldap/NG/Portal/Plugins/SingleSession.pm
lib/Lemonldap/NG/Portal/Plugins/SOAPServer.pm
lib/Lemonldap/NG/Portal/Plugins/Status.pm
lib/Lemonldap/NG/Portal/Plugins/U2F.pm
......@@ -275,6 +279,8 @@ site/templates/bootstrap/yubikeyform.tpl
site/templates/common/background.tpl
site/templates/common/bullet_go.png
site/templates/common/key.png
site/templates/common/mail/en.json
site/templates/common/mail/fr.json
site/templates/common/mail_confirm.tpl
site/templates/common/mail_footer.tpl
site/templates/common/mail_header.tpl
......@@ -396,6 +402,8 @@ t/43-MailReset-with-token.t
t/43-MailReset.t
t/50-IssuerGet.t
t/60-status.t
t/61-grantSession.t
t/62-singleSession.t
t/90-translations.t
t/99-pod.t
t/lmConf-1.js
......
......@@ -7,6 +7,7 @@ package Lemonldap::NG::Portal::Lib::SMTP;
use strict;
use Mouse;
use JSON qw(from_json);
use String::Random;
use MIME::Lite;
use MIME::Base64;
......@@ -27,6 +28,24 @@ has charset => (
default => sub { return $_[0]->{conf}->{mailCharset} || 'utf-8' }
);
sub translate {
my ( $self, $req ) = @_;
# Get language using llnglanguage cookie
my $lang = $req->cookies->{llnglanguage} || 'en';
my $json = $self->conf->{templateDir} . "/common/mail/$lang.json";
$json = $self->conf->{templateDir} . '/common/mail/en.json'
unless ( -f $json );
open F, $json or die $!;
$json = join '', <F>;
close F;
$lang = from_json($json);
return sub {
($_) = @_;
$$_ =~ s/\s+trspan="(\w+?)"(.*?)>.*?</"$2>".($lang->{$1}||$1).'<'/gse;
};
}
# Generate a complex password based on a regular expression
# @param regexp regular expression
sub gen_password {
......
......@@ -2,6 +2,7 @@ package Lemonldap::NG::Portal::Plugins::MailReset;
use strict;
use Encode;
use HTML::Template;
use Mouse;
use POSIX qw(strftime);
use Lemonldap::NG::Portal::Main::Constants qw(
......@@ -306,7 +307,10 @@ sub _reset {
. '/mail_confirm.tpl';
$tplfile = $self->conf->{templateDir} . '/common/mail_confirm.tpl'
unless ( -e $tplfile );
my $template = HTML::Template->new( filename => $tplfile, );
my $template = HTML::Template->new(
filename => $tplfile,
filter => $self->translate($req),
);
$body = $template->output();
$html = 1;
}
......@@ -428,7 +432,10 @@ sub changePwd {
. '/mail_password.tpl';
$tplfile = $self->conf->{templateDir} . '/common/mail_password.tpl'
unless ( -e $tplfile );
my $template = HTML::Template->new( filename => $tplfile, );
my $template = HTML::Template->new(
filename => $tplfile,
filter => $self->translate($req),
);
$body = $template->output();
$html = 1;
}
......
......@@ -2,6 +2,7 @@ package Lemonldap::NG::Portal::Plugins::Register;
use strict;
use Encode;
use HTML::Template;
use Mouse;
use POSIX qw(strftime);
use Lemonldap::NG::Portal::Main::Constants qw(
......@@ -191,7 +192,8 @@ sub _register {
elsif ( $self->ott ) {
unless ( $self->ott->getToken($token) ) {
$self->setSecurity($req);
$self->userLogger->notice('Register try with expired/bad token');
$self->userLogger->notice(
'Register try with expired/bad token');
return PE_TOKENEXPIRED;
}
}
......@@ -296,7 +298,10 @@ sub _register {
$tplfile =
$self->conf->{templateDir} . '/common/mail_register_confirm.tpl'
unless ( -e $tplfile );
my $template = HTML::Template->new( filename => $tplfile, );
my $template = HTML::Template->new(
filename => $tplfile,
filter => $self->translate($req),
);
$body = $template->output();
# Replace variables in body
......@@ -351,7 +356,10 @@ sub _register {
. "/mail_register_done.tpl";
$tplfile = $self->conf->{templateDir} . "/common/mail_register_done.tpl"
unless ( -e $tplfile );
my $template = HTML::Template->new( filename => $tplfile, );
my $template = HTML::Template->new(
filename => $tplfile,
filter => $self->translate($req),
);
$body = $template->output();
# Replace variables in body
......
......@@ -219,6 +219,7 @@ $(document).ready ->
lang = if langs[0] then langs[0] else if langs2[0] then langs2[0] else 'en'
else
lang = 'en'
setCookie 'llnglanguage', lang
translatePage(lang)
# Build language icons
......
......@@ -231,6 +231,7 @@ LemonLDAP::NG Portal jQuery scripts
lang = 'en';
}
}
setCookie('llnglanguage', lang);
translatePage(lang);
langdiv = '';
ref1 = window.availableLanguages;
......
(function(){var e,g,j,d,a,k,i,m,f,b,l,c,h=[].indexOf||function(p){for(var o=0,n=this.length;o<n;o++){if(o in this&&this[o]===p){return o}}return -1};c={};l=function(n){return $.getJSON(window.staticPrefix+"languages/"+n+".json",function(o){c=o;$("[trspan]").each(function(){var s,t,q,p,r;s=$(this).attr("trspan").split(",");p=b(s.shift());for(t=0,q=s.length;t<q;t++){r=s[t];p.replace(/%[ds]/,r)}return $(this).text(p)});return $("[trmsg]").each(function(){return $(this).text(b("PE"+($(this).attr("trmsg"))))})})};b=function(n){if(c[n]){return c[n]}else{return n}};window.translate=b;d=function(){var n;n={};$("script[type='application/init']").each(function(){var s,p,o,r,q;try{q=JSON.parse($(this).text());r=[];for(o in q){r.push(n[o]=q[o])}return r}catch(p){s=p;console.log("Parsing error",s);return console.log("JSON",$(this).text())}});return n};f="#appslist";j=function(){return $.ajax({type:"POST",url:e.scriptname,data:{storeAppsListOrder:$(f).sortable("toArray").join()},dataType:"json"})};i=function(){var p,o,s,A,n,x,r,t,q,w,y,u,z;w=$(f);if(!((w!=null)&&e.appslistorder)){return null}p=e.appslistorder.split(",");x=w.sortable("toArray");y=[];for(s=0,t=x.length;s<t;s++){z=x[s];y[z]=z}for(r=0,q=p.length;r<q;r++){n=p[r];if(h.call(y,n)>=0){A=y[n];o=$(f+".ui-sortable").children("#"+A);u=$(f+".ui-sortable").children("#"+n);o.remove();$(f+".ui-sortable").filter(":first").append(u)}}return 1};a=function(n){return $("#lmhidden_"+n).length};k=function(){return $.ajax({type:"POST",url:e.scriptname,data:{ping:1},dataType:"json",success:function(n){if(n.auth){return setTimeout(k,e.pingInterval)}else{return location.reload(true)}}})};window.ping=k;g=function(q){var t,o,r,n,p,s;p=q+"=";o=decodeURIComponent(document.cookie).split(";");s=new RegExp("^ *"+q+"=");for(r=0,n=o.length;r<n;r++){t=o[r];if(t.match(s)){t=t.replace(s,"");return t}}return""};m=function(n,p,o){var q;q=new Date();q.setTime(q.getTime()+o*86400000);return document.cookie=n+"="+p+"; expires="+(q.toUTCString())+"; path=/"};e={};$(document).ready(function(){var D,C,F,B,G,E,A,I,y,x,w,H,u,t,s,z,q,p,o,n,r,v;e=d();window.datas=e;if(e.antiframe&&top!==self){top.location.href=location.href}$("#appslist").sortable({axis:"y",cursor:"move",opacity:0.5,revert:true,items:"> div.category",update:function(){return j()}});i();$("div.message").fadeIn("slow");$("input[name=timezone]").val(-(new Date().getTimezoneOffset()/60));q=$("#menu").tabs({active:0});z=$('#menu a[href="#'+e.displaytab+'"]').parent().index();if(z<0){z=0}q.tabs("option","active",z);F=$("#authMenu").tabs({active:0});if(e.choicetab){F.tabs("option","active",$('#authMenu a[href="#'+e.choicetab+'"]').parent().index())}if(e.login){$("input[type=password]:first").focus()}else{$("input[type!=hidden]:first").focus()}if(e.newwindow){$("#appslist a").attr("target","_blank")}if($("p.removeOther").length){D=$("form.login").attr("action");p=$("form.login").attr("method");B="";if(D.indexOf("?")!==-1){D.substring(0,D.indexOf("?"))+"?"}else{B=D+"?"}$("form.login input[type=hidden]").each(function(J){return B+="&"+$(this).attr("name")+"="+$(this).val()});s=$("p.removeOther a").attr("href")+"&method="+p+"&url="+btoa(B);$("p.removeOther a").attr("href",s)}I=g("llnglanguage");if(!I){if(navigator){x=[];w=[];n=[navigator.language];if(navigator.languages){n=navigator.languages}r=window.availableLanguages;for(G=0,H=r.length;G<H;G++){C=r[G];y+='<img class="langicon" src="'+window.staticPrefix+"common/"+C+'.png" title="'+C+'"> ';for(E=0,u=n.length;E<u;E++){o=n[E];if(C===o){x.push(C)}else{if(C.substring(0,1)===o.substring(0,1)){w.push(C)}}}}I=x[0]?x[0]:w[0]?w[0]:"en"}else{I="en"}}l(I);y="";v=window.availableLanguages;for(A=0,t=v.length;A<t;A++){C=v[A];y+='<img class="langicon" src="'+window.staticPrefix+"common/"+C+'.png" title="'+C+'"> '}$("#languages").html(y);$(".langicon").on("click",function(){I=$(this).attr("title");m("llnglanguage",I);return l(I)});if(e.pingInterval&&e.pingInterval>0){window.setTimeout(k,e.pingInterval)}return $(".localeDate").each(function(){var J;J=new Date($(this).attr("val")*1000);return $(this).text(J.toLocaleString())})})}).call(this);
\ No newline at end of file
(function(){var e,g,j,d,a,k,i,m,f,b,l,c,h=[].indexOf||function(p){for(var o=0,n=this.length;o<n;o++){if(o in this&&this[o]===p){return o}}return -1};c={};l=function(n){return $.getJSON(window.staticPrefix+"languages/"+n+".json",function(o){c=o;$("[trspan]").each(function(){var s,t,q,p,r;s=$(this).attr("trspan").split(",");p=b(s.shift());for(t=0,q=s.length;t<q;t++){r=s[t];p.replace(/%[ds]/,r)}return $(this).text(p)});return $("[trmsg]").each(function(){return $(this).text(b("PE"+($(this).attr("trmsg"))))})})};b=function(n){if(c[n]){return c[n]}else{return n}};window.translate=b;d=function(){var n;n={};$("script[type='application/init']").each(function(){var s,p,o,r,q;try{q=JSON.parse($(this).text());r=[];for(o in q){r.push(n[o]=q[o])}return r}catch(p){s=p;console.log("Parsing error",s);return console.log("JSON",$(this).text())}});return n};f="#appslist";j=function(){return $.ajax({type:"POST",url:e.scriptname,data:{storeAppsListOrder:$(f).sortable("toArray").join()},dataType:"json"})};i=function(){var p,o,s,A,n,x,r,t,q,w,y,u,z;w=$(f);if(!((w!=null)&&e.appslistorder)){return null}p=e.appslistorder.split(",");x=w.sortable("toArray");y=[];for(s=0,t=x.length;s<t;s++){z=x[s];y[z]=z}for(r=0,q=p.length;r<q;r++){n=p[r];if(h.call(y,n)>=0){A=y[n];o=$(f+".ui-sortable").children("#"+A);u=$(f+".ui-sortable").children("#"+n);o.remove();$(f+".ui-sortable").filter(":first").append(u)}}return 1};a=function(n){return $("#lmhidden_"+n).length};k=function(){return $.ajax({type:"POST",url:e.scriptname,data:{ping:1},dataType:"json",success:function(n){if(n.auth){return setTimeout(k,e.pingInterval)}else{return location.reload(true)}}})};window.ping=k;g=function(q){var t,o,r,n,p,s;p=q+"=";o=decodeURIComponent(document.cookie).split(";");s=new RegExp("^ *"+q+"=");for(r=0,n=o.length;r<n;r++){t=o[r];if(t.match(s)){t=t.replace(s,"");return t}}return""};m=function(n,p,o){var q;q=new Date();q.setTime(q.getTime()+o*86400000);return document.cookie=n+"="+p+"; expires="+(q.toUTCString())+"; path=/"};e={};$(document).ready(function(){var D,C,F,B,G,E,A,I,y,x,w,H,u,t,s,z,q,p,o,n,r,v;e=d();window.datas=e;if(e.antiframe&&top!==self){top.location.href=location.href}$("#appslist").sortable({axis:"y",cursor:"move",opacity:0.5,revert:true,items:"> div.category",update:function(){return j()}});i();$("div.message").fadeIn("slow");$("input[name=timezone]").val(-(new Date().getTimezoneOffset()/60));q=$("#menu").tabs({active:0});z=$('#menu a[href="#'+e.displaytab+'"]').parent().index();if(z<0){z=0}q.tabs("option","active",z);F=$("#authMenu").tabs({active:0});if(e.choicetab){F.tabs("option","active",$('#authMenu a[href="#'+e.choicetab+'"]').parent().index())}if(e.login){$("input[type=password]:first").focus()}else{$("input[type!=hidden]:first").focus()}if(e.newwindow){$("#appslist a").attr("target","_blank")}if($("p.removeOther").length){D=$("form.login").attr("action");p=$("form.login").attr("method");B="";if(D.indexOf("?")!==-1){D.substring(0,D.indexOf("?"))+"?"}else{B=D+"?"}$("form.login input[type=hidden]").each(function(J){return B+="&"+$(this).attr("name")+"="+$(this).val()});s=$("p.removeOther a").attr("href")+"&method="+p+"&url="+btoa(B);$("p.removeOther a").attr("href",s)}I=g("llnglanguage");if(!I){if(navigator){x=[];w=[];n=[navigator.language];if(navigator.languages){n=navigator.languages}r=window.availableLanguages;for(G=0,H=r.length;G<H;G++){C=r[G];y+='<img class="langicon" src="'+window.staticPrefix+"common/"+C+'.png" title="'+C+'"> ';for(E=0,u=n.length;E<u;E++){o=n[E];if(C===o){x.push(C)}else{if(C.substring(0,1)===o.substring(0,1)){w.push(C)}}}}I=x[0]?x[0]:w[0]?w[0]:"en"}else{I="en"}}m("llnglanguage",I);l(I);y="";v=window.availableLanguages;for(A=0,t=v.length;A<t;A++){C=v[A];y+='<img class="langicon" src="'+window.staticPrefix+"common/"+C+'.png" title="'+C+'"> '}$("#languages").html(y);$(".langicon").on("click",function(){I=$(this).attr("title");m("llnglanguage",I);return l(I)});if(e.pingInterval&&e.pingInterval>0){window.setTimeout(k,e.pingInterval)}return $(".localeDate").each(function(){var J;J=new Date($(this).attr("val")*1000);return $(this).text(J.toLocaleString())})})}).call(this);
\ No newline at end of file
......@@ -98,7 +98,6 @@
"authPortal":"Authentication portal",
"authRemaining":"%s authentications remaining, change your password!",
"autoAccept":"Automatically accept in 5 seconds",
"autoMail":"This mail was sent automatically",
"back2CasUrl":"The application you just logged out of has provided a link it would like you to follow",
"back2Portal":"Go back to portal",
"cancel":"Cancel",
......@@ -106,8 +105,6 @@
"changePwd":"Change your password",
"checkLastLogins":"Check my last logins",
"chooseApp":"Choose an application your are allowed to access to",
"click2Register":"Click here to confirm your account registration",
"click2Reset":"Click here to reset your password",
"clickHere":"Please click here",
"closeSSO":"Close your SSO session",
"confirmation":"Confirmation",
......@@ -129,7 +126,6 @@
"gotNewMessages":"You have some new messages",
"goToPortal":"Go to portal",
"gplSoft":"free software covered by the GPL license",
"hello":"Hello",
"imSure":"I'm sure",
"info":"Information",
"ipAddr":"IP address",
......@@ -147,7 +143,6 @@
"maintenanceMode":"This application is in maintenance, please try to connect later",
"newMessages":"New message(s)",
"newPassword":"New password",
"newPwdIs":"Your new password is",
"newPwdSentTo":"A confirmation has been sent to your mail address.",
"oidcConsent":"The application %s would like to know:",
"openidAp":"Do you agree to provide the following parameters?",
......@@ -160,9 +155,7 @@
"otherSessions":"Other active sessions",
"password": "Password",
"ppGrace": "authentications remaining, change your password!",
"pwdChanged":"Your password was changed.",
"pwdChange":"Password change",
"pwdIs":"Your password is",
"pwd":"Password",
"pwdResetAlreadyIssued":"A password reset request was already issued on ",
"pwdWillExpire":"%s days, %s hours, %s minutes and %s seconds before password expiration, change it!",
......@@ -175,7 +168,6 @@
"registerRequestAlreadyIssued":"A register request for this account was already issued on ",
"rememberChoice":"Remember my choice",
"removeOtherSessions":"Remove other sessions",
"requestIssuedFromIP":"The request was issued from IP",
"resendConfirmMail":"Resend confirmation mail?",
"resentConfirm":"Do you want the confirmation mail to be resent?",
"resetPwd":"Reset my password",
......@@ -205,7 +197,6 @@
"yourEmail":"Your email",
"yourIdentity":"Your identity",
"yourIdentityIs":"Your identity is",
"yourLoginIs":"Your login is",
"yourPhone":"Your phone number",
"yourProfile":"Your profile"
}
......@@ -98,7 +98,6 @@
"authPortal":"Portail d'authentification",
"authRemaining":"%s authentifications restantes, changez votre mot de passe !",
"autoAccept":"Acceptation automatique dans 5 secondes",
"autoMail":"Ceci est un message automatique",
"back2CasUrl":"Le service duquel vous arrivez a fourni un lien que vous êtes invité à suivre",
"back2Portal":"Retourner au portail",
"cancel":"Annuler",
......@@ -106,8 +105,6 @@
"changePwd":"Changez votre mot de passe",
"checkLastLogins":"Voir mes dernières connexions",
"chooseApp":"Choisissez une application à laquelle vous êtes autorisé à accéder",
"click2Register":"Cliquez ici pour confirmer l'enregistrement de votre compte",
"click2Reset":"Cliquez ici pour réinitialiser votre mot de passe",
"clickHere":"Cliquez ici",
"closeSSO":"Fermer votre Session SSO",
"confirmation":"Confirmation",
......@@ -129,7 +126,6 @@
"gotNewMessages":"Vous avez de nouveaux messages",
"goToPortal":"Aller au portail",
"gplSoft":"logiciel libre protégé par la licence GPL",
"hello":"Bonjour",
"imSure":"Je suis sûr",
"info":"Information",
"ipAddr":"Adresse IP",
......@@ -147,7 +143,6 @@
"maintenanceMode":"Cette application est en maintenance, merci de réessayer plus tard",
"newMessages":"Nouveaux messages",
"newPassword":"Nouveau mot de passe",
"newPwdIs":"Votre nouveau mot de passe est",
"newPwdSentTo":"Une confirmation a été envoyée à votre adresse mail.",
"oidcConsent":"L'application %s voudrait connaître :",
"openidAp":"Consentez-vous à communiquer les paramètres suivants&nbsp;?",
......@@ -161,8 +156,6 @@
"password": "Mot-de-passe",
"ppGrace": "authentifications restantes, changez votre mot de passe !",
"pwdChange":"Changement de mot de passe",
"pwdChanged":"Votre mot de passe a été changé.",
"pwdIs":"Votre mot de passe est",
"pwd":"Mot de passe",
"pwdResetAlreadyIssued":"Une demande de réinitialisation de mot de passe a déjà été faite le ",
"pwdWillExpire":"%s jours, %s heures, %s minutes et %s secondes avant expiration de votre mot de passe, pensez à le changer !",
......@@ -175,7 +168,6 @@
"registerRequestAlreadyIssued":"Une demande de création pour ce compte a déjà été faite le ",
"rememberChoice":"Se souvenir de mon choix",
"removeOtherSessions":"Fermer les autres sessions",
"requestIssuedFromIP":"La demande provient de l'IP",
"resendConfirmMail":"Renvoyer le mail de confirmation ?",
"resentConfirm":"Voulez-vous que le message de confirmation soit renvoyé ?",
"resetPwd":"Réinitialiser mon mot de passe",
......@@ -205,7 +197,6 @@
"yourEmail":"Votre adresse électronique",
"yourIdentity":"Votre identité",
"yourIdentityIs":"Votre identité est&nbsp;",
"yourLoginIs":"Votre identifiant est",
"yourPhone":"Votre numéro de téléphone",
"yourProfile":"Vos informations personnelles"
}
{
"accountCreated":"Your account has been created, your temporary password has been sent to your mail address.",
"autoMail":"This mail was sent automatically",
"click2Register":"Click here to confirm your account registration",
"click2Reset":"Click here to reset your password",
"hello":"Hello",
"newPwdIs":"Your new password is",
"pwdChanged":"Your password was changed.",
"pwdIs":"Your password is",
"requestIssuedFromIP":"The request was issued from IP",
"yourLoginIs":"Your login is"
}
{
"accountCreated":"Votre compte a été créé, un mot de passe temporaire a été envoyé à votre adresse mail.",
"autoMail":"Ceci est un message automatique",
"click2Register":"Cliquez ici pour confirmer l'enregistrement de votre compte",
"click2Reset":"Cliquez ici pour réinitialiser votre mot de passe",
"hello":"Bonjour",
"newPwdIs":"Votre nouveau mot de passe est",
"pwdChanged":"Votre mot de passe a été changé.",
"pwdIs":"Votre mot de passe est",
"requestIssuedFromIP":"La demande provient de l'IP",
"yourLoginIs":"Votre identifiant est"
}
......@@ -122,7 +122,7 @@ sub MIME::Lite::send {
$mailSend = 2;
ok(
$mail->body_as_string =~
m#yourLoginIs.+?<b>(\w+)</b>.*?pwdIs.+?<b>(.*?)</b>#s,
m#Your login is.+?<b>(\w+)</b>.*?Your password is.+?<b>(.*?)</b>#s,
'Get login/pwd'
);
( $user, $pwd ) = ( $1, $2 );
......
......@@ -114,7 +114,7 @@ sub MIME::Lite::send {
$mailSend = 2;
ok(
$mail->body_as_string =~
m#yourLoginIs.+?<b>(\w+)</b>.*?pwdIs.+?<b>(.*?)</b>#s,
m#Your login is.+?<b>(\w+)</b>.*?Your password is.+?<b>(.*?)</b>#s,
'Get login/pwd'
);
( $user, $pwd ) = ( $1, $2 );
......
......@@ -101,7 +101,7 @@ sub MIME::Lite::send {
$mailSend = 2;
ok(
$mail->body_as_string =~
m#yourLoginIs.+?<b>(\w+)</b>.*?pwdIs.+?<b>(.*?)</b>#s,
m#Your login is.+?<b>(\w+)</b>.*?Your password is.+?<b>(.*?)</b>#s,
'Get login/pwd'
);
( $user, $pwd ) = ( $1, $2 );
......
......@@ -116,7 +116,7 @@ sub MIME::Lite::send {
}
else {
$mailSend = 2;
ok( $mail->body_as_string =~ /pwdChanged/, ' Password was changed' );
ok( $mail->body_as_string =~ /Your password was changed/, ' Password was changed' );
count(1);
}
pass('----- Mail sent -----');
......
......@@ -98,7 +98,7 @@ sub MIME::Lite::send {
}
else {
$mailSend = 2;
ok( $mail->body_as_string =~ /pwdChanged/, ' Password was changed' );
ok( $mail->body_as_string =~ /Your password was changed/, ' Password was changed' );
( $user, $pwd ) = ( $1, $2 );
count(1);
}
......
......@@ -96,7 +96,7 @@ sub MIME::Lite::send {
}
else {
$mailSend = 2;
ok( $mail->body_as_string =~ /pwdChanged/, ' Password was changed' );
ok( $mail->body_as_string =~ /Your password was changed/, ' Password was changed' );
( $user, $pwd ) = ( $1, $2 );
count(1);
}
......
......@@ -66,7 +66,7 @@ my @unTr = ();
find(
sub {
my $f = $File::Find::name;
return unless ( $_ =~ /tpl$/ and -f $_ );
return unless ( $_ =~ /tpl$/ and -f $_ and $_ !~ m#mail_# );
open F, $_;
while ( my $l = <F> ) {
push @trspan, ( $l =~ /trspan="(\w+)"/g );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment