Move default mail subjects in JSON (may close #1033)

environments/ppa-mbqj77/deployments/1
Xavier Guimard 8 years ago
parent 2e680c2ff1
commit 697ebfdf8e
  1. 33
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm
  2. 12
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm
  3. 4
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm
  4. 2
      lemonldap-ng-manager/site/static/struct.json
  5. 1
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SMTP.pm
  6. 14
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/MailReset.pm
  7. 15
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/Register.pm
  8. 4
      lemonldap-ng-portal/site/templates/common/mail/en.json
  9. 4
      lemonldap-ng-portal/site/templates/common/mail/fr.json
  10. 1
      lemonldap-ng-portal/t/43-MailReset.t

@ -101,20 +101,18 @@ sub defaultValues {
'locationRules' => { 'locationRules' => {
'default' => 'deny' 'default' => 'deny'
}, },
'loginHistoryEnabled' => 1, 'loginHistoryEnabled' => 1,
'logoutServices' => {}, 'logoutServices' => {},
'macros' => {}, 'macros' => {},
'mailCharset' => 'utf-8', 'mailCharset' => 'utf-8',
'mailConfirmSubject' => '[LemonLDAP::NG] Password reset confirmation', 'mailFrom' => 'noreply@example.com',
'mailFrom' => 'noreply@example.com', 'mailSessionKey' => 'mail',
'mailSessionKey' => 'mail', 'mailTimeout' => 0,
'mailSubject' => '[LemonLDAP::NG] Your new password', 'mailUrl' => 'http://auth.example.com/resetpwd',
'mailTimeout' => 0, 'managerDn' => '',
'mailUrl' => 'http://auth.example.com/resetpwd', 'managerPassword' => '',
'managerDn' => '', 'multiValuesSeparator' => '; ',
'managerPassword' => '', 'notificationStorage' => 'File',
'multiValuesSeparator' => '; ',
'notificationStorage' => 'File',
'notificationStorageOptions' => { 'notificationStorageOptions' => {
'dirName' => '/var/lib/lemonldap-ng/notifications' 'dirName' => '/var/lib/lemonldap-ng/notifications'
}, },
@ -167,11 +165,8 @@ sub defaultValues {
'radiusAuthnLevel' => 3, 'radiusAuthnLevel' => 3,
'randomPasswordRegexp' => '[A-Z]{3}[a-z]{5}.\\d{2}', 'randomPasswordRegexp' => '[A-Z]{3}[a-z]{5}.\\d{2}',
'redirectFormMethod' => 'get', 'redirectFormMethod' => 'get',
'registerConfirmSubject' => 'registerDB' => 'Null',
'[LemonLDAP::NG] Account register confirmation', 'registerTimeout' => 0,
'registerDB' => 'Null',
'registerDoneSubject' => '[LemonLDAP::NG] Your new account',
'registerTimeout' => 0,
'remoteGlobalStorage' => 'Lemonldap::NG::Common::Apache::Session::SOAP', 'remoteGlobalStorage' => 'Lemonldap::NG::Common::Apache::Session::SOAP',
'remoteGlobalStorageOptions' => { 'remoteGlobalStorageOptions' => {
'ns' => 'ns' =>

@ -1333,8 +1333,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
'type' => 'longtext' 'type' => 'longtext'
}, },
'mailConfirmSubject' => { 'mailConfirmSubject' => {
'default' => '[LemonLDAP::NG] Password reset confirmation', 'type' => 'text'
'type' => 'text'
}, },
'mailFrom' => { 'mailFrom' => {
'default' => 'noreply@example.com', 'default' => 'noreply@example.com',
@ -1355,8 +1354,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
'type' => 'text' 'type' => 'text'
}, },
'mailSubject' => { 'mailSubject' => {
'default' => '[LemonLDAP::NG] Your new password', 'type' => 'text'
'type' => 'text'
}, },
'mailTimeout' => { 'mailTimeout' => {
'default' => 0, 'default' => 0,
@ -2014,8 +2012,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
'type' => 'select' 'type' => 'select'
}, },
'registerConfirmSubject' => { 'registerConfirmSubject' => {
'default' => '[LemonLDAP::NG] Account register confirmation', 'type' => 'text'
'type' => 'text'
}, },
'registerDB' => { 'registerDB' => {
'default' => 'Null', 'default' => 'Null',
@ -2040,8 +2037,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
'type' => 'select' 'type' => 'select'
}, },
'registerDoneSubject' => { 'registerDoneSubject' => {
'default' => '[LemonLDAP::NG] Your new account', 'type' => 'text'
'type' => 'text'
}, },
'registerTimeout' => { 'registerTimeout' => {
'default' => 0, 'default' => 0,

@ -873,7 +873,6 @@ sub attributes {
mailConfirmBody => { type => 'longtext', }, mailConfirmBody => { type => 'longtext', },
mailConfirmSubject => { mailConfirmSubject => {
type => 'text', type => 'text',
default => '[LemonLDAP::NG] Password reset confirmation',
documentation => 'Mail subject for reset confirmation', documentation => 'Mail subject for reset confirmation',
}, },
mailFrom => { mailFrom => {
@ -889,7 +888,6 @@ sub attributes {
}, },
mailSubject => { mailSubject => {
type => 'text', type => 'text',
default => '[LemonLDAP::NG] Your new password',
documentation => 'Mail subject for new password email', documentation => 'Mail subject for new password email',
}, },
mailTimeout => { mailTimeout => {
@ -914,7 +912,6 @@ sub attributes {
# Registration # Registration
registerConfirmSubject => { registerConfirmSubject => {
type => 'text', type => 'text',
default => '[LemonLDAP::NG] Account register confirmation',
documentation => 'Mail subject for register confirmation', documentation => 'Mail subject for register confirmation',
}, },
registerDB => { registerDB => {
@ -930,7 +927,6 @@ sub attributes {
}, },
registerDoneSubject => { registerDoneSubject => {
type => 'text', type => 'text',
default => '[LemonLDAP::NG] Your new account',
documentation => 'Mail subject when register is done', documentation => 'Mail subject when register is done',
}, },
registerTimeout => { registerTimeout => {

File diff suppressed because one or more lines are too long

@ -43,6 +43,7 @@ sub translate {
return sub { return sub {
($_) = @_; ($_) = @_;
$$_ =~ s/\s+trspan="(\w+?)"(.*?)>.*?</"$2>".($lang->{$1}||$1).'<'/gse; $$_ =~ s/\s+trspan="(\w+?)"(.*?)>.*?</"$2>".($lang->{$1}||$1).'<'/gse;
$$_ =~ s/^(\w+)$/$lang->{$1}||$1/es;
}; };
} }

@ -290,7 +290,12 @@ sub _reset {
if ( $req->datas->{_authChoice} ); if ( $req->datas->{_authChoice} );
# Build mail content # Build mail content
my $tr = $self->translate($req);
my $subject = $self->conf->{mailConfirmSubject}; my $subject = $self->conf->{mailConfirmSubject};
unless ($subject) {
$subject = 'mailConfirmSubject';
$tr->( \$subject );
}
my $body; my $body;
my $html; my $html;
if ( $self->conf->{mailConfirmBody} ) { if ( $self->conf->{mailConfirmBody} ) {
@ -309,7 +314,7 @@ sub _reset {
unless ( -e $tplfile ); unless ( -e $tplfile );
my $template = HTML::Template->new( my $template = HTML::Template->new(
filename => $tplfile, filename => $tplfile,
filter => $self->translate($req), filter => $tr,
); );
$body = $template->output(); $body = $template->output();
$html = 1; $html = 1;
@ -415,7 +420,12 @@ sub changePwd {
$req->{sessionInfo}->{ $self->conf->{mailSessionKey} } ); $req->{sessionInfo}->{ $self->conf->{mailSessionKey} } );
# Build mail content # Build mail content
my $tr = $self->translate($req);
my $subject = $self->conf->{mailSubject}; my $subject = $self->conf->{mailSubject};
unless ($subject) {
$subject = 'mailSubject';
$tr->( \$subject );
}
my $body; my $body;
my $html; my $html;
if ( $self->conf->{mailBody} ) { if ( $self->conf->{mailBody} ) {
@ -434,7 +444,7 @@ sub changePwd {
unless ( -e $tplfile ); unless ( -e $tplfile );
my $template = HTML::Template->new( my $template = HTML::Template->new(
filename => $tplfile, filename => $tplfile,
filter => $self->translate($req), filter => $tr,
); );
$body = $template->output(); $body = $template->output();
$html = 1; $html = 1;

@ -286,7 +286,12 @@ sub _register {
if ( $req->datas->{_authChoice} ); if ( $req->datas->{_authChoice} );
# Build mail content # Build mail content
my $tr = $self->translate($req);
my $subject = $self->conf->{registerConfirmSubject}; my $subject = $self->conf->{registerConfirmSubject};
unless ($subject) {
$subject = 'registerConfirmSubject';
$tr->( \$subject );
}
my $body; my $body;
my $html = 1; my $html = 1;
@ -300,7 +305,7 @@ sub _register {
unless ( -e $tplfile ); unless ( -e $tplfile );
my $template = HTML::Template->new( my $template = HTML::Template->new(
filename => $tplfile, filename => $tplfile,
filter => $self->translate($req), filter => $tr,
); );
$body = $template->output(); $body = $template->output();
@ -345,7 +350,13 @@ sub _register {
return $result; return $result;
} }
# Build mail content
my $tr = $self->translate($req);
my $subject = $self->conf->{registerDoneSubject}; my $subject = $self->conf->{registerDoneSubject};
unless ($subject) {
$subject = 'registerDoneSubject';
$tr->( \$subject );
}
my $body; my $body;
my $html = 1; my $html = 1;
@ -358,7 +369,7 @@ sub _register {
unless ( -e $tplfile ); unless ( -e $tplfile );
my $template = HTML::Template->new( my $template = HTML::Template->new(
filename => $tplfile, filename => $tplfile,
filter => $self->translate($req), filter => $tr,
); );
$body = $template->output(); $body = $template->output();

@ -4,9 +4,13 @@
"click2Register":"Click here to confirm your account registration", "click2Register":"Click here to confirm your account registration",
"click2Reset":"Click here to reset your password", "click2Reset":"Click here to reset your password",
"hello":"Hello", "hello":"Hello",
"mailConfirmSubject": "[LemonLDAP::NG] Password reset confirmation",
"mailSubject": "[LemonLDAP::NG] Your new password",
"newPwdIs":"Your new password is", "newPwdIs":"Your new password is",
"pwdChanged":"Your password was changed.", "pwdChanged":"Your password was changed.",
"pwdIs":"Your password is", "pwdIs":"Your password is",
"registerConfirmSubject": "[LemonLDAP::NG] Account register confirmation",
"registerDoneSubject": "[LemonLDAP::NG] Your new account",
"requestIssuedFromIP":"The request was issued from IP", "requestIssuedFromIP":"The request was issued from IP",
"yourLoginIs":"Your login is" "yourLoginIs":"Your login is"
} }

@ -4,9 +4,13 @@
"click2Register":"Cliquez ici pour confirmer l'enregistrement de votre compte", "click2Register":"Cliquez ici pour confirmer l'enregistrement de votre compte",
"click2Reset":"Cliquez ici pour réinitialiser votre mot de passe", "click2Reset":"Cliquez ici pour réinitialiser votre mot de passe",
"hello":"Bonjour", "hello":"Bonjour",
"mailConfirmSubject": "[LemonLDAP::NG] Confirmation de réinitialisation de mot de passe",
"mailSubject": "[LemonLDAP::NG] Votre nouveau mot-de-passe",
"newPwdIs":"Votre nouveau mot de passe est", "newPwdIs":"Votre nouveau mot de passe est",
"pwdChanged":"Votre mot de passe a été changé.", "pwdChanged":"Votre mot de passe a été changé.",
"pwdIs":"Votre mot de passe est", "pwdIs":"Votre mot de passe est",
"registerConfirmSubject": "[LemonLDAP::NG] Confirmation d'enregistrement de compte",
"registerDoneSubject": "[LemonLDAP::NG] Votre nouveau compte",
"requestIssuedFromIP":"La demande provient de l'IP", "requestIssuedFromIP":"La demande provient de l'IP",
"yourLoginIs":"Votre identifiant est" "yourLoginIs":"Votre identifiant est"
} }

@ -83,6 +83,7 @@ sub MIME::Lite::send {
ok( $mail->header_as_string =~ /dwho\@badwolf.org/s, ' Found dest' ) ok( $mail->header_as_string =~ /dwho\@badwolf.org/s, ' Found dest' )
or explain( $mail->header_as_string, 'To: dwho@badwolf.org' ); or explain( $mail->header_as_string, 'To: dwho@badwolf.org' );
count(2); count(2);
print STDERR $mail->header_as_string."\n";
unless ($mail2) { unless ($mail2) {
$mailSend = 1; $mailSend = 1;
ok( ok(

Loading…
Cancel
Save