Commit 697ebfdf authored by Xavier Guimard's avatar Xavier Guimard

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

parent 2e680c2f
......@@ -101,20 +101,18 @@ sub defaultValues {
'locationRules' => {
'default' => 'deny'
},
'loginHistoryEnabled' => 1,
'logoutServices' => {},
'macros' => {},
'mailCharset' => 'utf-8',
'mailConfirmSubject' => '[LemonLDAP::NG] Password reset confirmation',
'mailFrom' => 'noreply@example.com',
'mailSessionKey' => 'mail',
'mailSubject' => '[LemonLDAP::NG] Your new password',
'mailTimeout' => 0,
'mailUrl' => 'http://auth.example.com/resetpwd',
'managerDn' => '',
'managerPassword' => '',
'multiValuesSeparator' => '; ',
'notificationStorage' => 'File',
'loginHistoryEnabled' => 1,
'logoutServices' => {},
'macros' => {},
'mailCharset' => 'utf-8',
'mailFrom' => 'noreply@example.com',
'mailSessionKey' => 'mail',
'mailTimeout' => 0,
'mailUrl' => 'http://auth.example.com/resetpwd',
'managerDn' => '',
'managerPassword' => '',
'multiValuesSeparator' => '; ',
'notificationStorage' => 'File',
'notificationStorageOptions' => {
'dirName' => '/var/lib/lemonldap-ng/notifications'
},
......@@ -167,11 +165,8 @@ sub defaultValues {
'radiusAuthnLevel' => 3,
'randomPasswordRegexp' => '[A-Z]{3}[a-z]{5}.\\d{2}',
'redirectFormMethod' => 'get',
'registerConfirmSubject' =>
'[LemonLDAP::NG] Account register confirmation',
'registerDB' => 'Null',
'registerDoneSubject' => '[LemonLDAP::NG] Your new account',
'registerTimeout' => 0,
'registerDB' => 'Null',
'registerTimeout' => 0,
'remoteGlobalStorage' => 'Lemonldap::NG::Common::Apache::Session::SOAP',
'remoteGlobalStorageOptions' => {
'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'
},
'mailConfirmSubject' => {
'default' => '[LemonLDAP::NG] Password reset confirmation',
'type' => 'text'
'type' => 'text'
},
'mailFrom' => {
'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'
},
'mailSubject' => {
'default' => '[LemonLDAP::NG] Your new password',
'type' => 'text'
'type' => 'text'
},
'mailTimeout' => {
'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'
},
'registerConfirmSubject' => {
'default' => '[LemonLDAP::NG] Account register confirmation',
'type' => 'text'
'type' => 'text'
},
'registerDB' => {
'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'
},
'registerDoneSubject' => {
'default' => '[LemonLDAP::NG] Your new account',
'type' => 'text'
'type' => 'text'
},
'registerTimeout' => {
'default' => 0,
......
......@@ -873,7 +873,6 @@ sub attributes {
mailConfirmBody => { type => 'longtext', },
mailConfirmSubject => {
type => 'text',
default => '[LemonLDAP::NG] Password reset confirmation',
documentation => 'Mail subject for reset confirmation',
},
mailFrom => {
......@@ -889,7 +888,6 @@ sub attributes {
},
mailSubject => {
type => 'text',
default => '[LemonLDAP::NG] Your new password',
documentation => 'Mail subject for new password email',
},
mailTimeout => {
......@@ -914,7 +912,6 @@ sub attributes {
# Registration
registerConfirmSubject => {
type => 'text',
default => '[LemonLDAP::NG] Account register confirmation',
documentation => 'Mail subject for register confirmation',
},
registerDB => {
......@@ -930,7 +927,6 @@ sub attributes {
},
registerDoneSubject => {
type => 'text',
default => '[LemonLDAP::NG] Your new account',
documentation => 'Mail subject when register is done',
},
registerTimeout => {
......
......@@ -43,6 +43,7 @@ sub translate {
return sub {
($_) = @_;
$$_ =~ 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} );
# Build mail content
my $tr = $self->translate($req);
my $subject = $self->conf->{mailConfirmSubject};
unless ($subject) {
$subject = 'mailConfirmSubject';
$tr->( \$subject );
}
my $body;
my $html;
if ( $self->conf->{mailConfirmBody} ) {
......@@ -309,7 +314,7 @@ sub _reset {
unless ( -e $tplfile );
my $template = HTML::Template->new(
filename => $tplfile,
filter => $self->translate($req),
filter => $tr,
);
$body = $template->output();
$html = 1;
......@@ -415,7 +420,12 @@ sub changePwd {
$req->{sessionInfo}->{ $self->conf->{mailSessionKey} } );
# Build mail content
my $tr = $self->translate($req);
my $subject = $self->conf->{mailSubject};
unless ($subject) {
$subject = 'mailSubject';
$tr->( \$subject );
}
my $body;
my $html;
if ( $self->conf->{mailBody} ) {
......@@ -434,7 +444,7 @@ sub changePwd {
unless ( -e $tplfile );
my $template = HTML::Template->new(
filename => $tplfile,
filter => $self->translate($req),
filter => $tr,
);
$body = $template->output();
$html = 1;
......
......@@ -286,7 +286,12 @@ sub _register {
if ( $req->datas->{_authChoice} );
# Build mail content
my $tr = $self->translate($req);
my $subject = $self->conf->{registerConfirmSubject};
unless ($subject) {
$subject = 'registerConfirmSubject';
$tr->( \$subject );
}
my $body;
my $html = 1;
......@@ -300,7 +305,7 @@ sub _register {
unless ( -e $tplfile );
my $template = HTML::Template->new(
filename => $tplfile,
filter => $self->translate($req),
filter => $tr,
);
$body = $template->output();
......@@ -345,7 +350,13 @@ sub _register {
return $result;
}
# Build mail content
my $tr = $self->translate($req);
my $subject = $self->conf->{registerDoneSubject};
unless ($subject) {
$subject = 'registerDoneSubject';
$tr->( \$subject );
}
my $body;
my $html = 1;
......@@ -358,7 +369,7 @@ sub _register {
unless ( -e $tplfile );
my $template = HTML::Template->new(
filename => $tplfile,
filter => $self->translate($req),
filter => $tr,
);
$body = $template->output();
......
......@@ -4,9 +4,13 @@
"click2Register":"Click here to confirm your account registration",
"click2Reset":"Click here to reset your password",
"hello":"Hello",
"mailConfirmSubject": "[LemonLDAP::NG] Password reset confirmation",
"mailSubject": "[LemonLDAP::NG] Your new password",
"newPwdIs":"Your new password is",
"pwdChanged":"Your password was changed.",
"pwdIs":"Your password is",
"registerConfirmSubject": "[LemonLDAP::NG] Account register confirmation",
"registerDoneSubject": "[LemonLDAP::NG] Your new account",
"requestIssuedFromIP":"The request was issued from IP",
"yourLoginIs":"Your login is"
}
......@@ -4,9 +4,13 @@
"click2Register":"Cliquez ici pour confirmer l'enregistrement de votre compte",
"click2Reset":"Cliquez ici pour réinitialiser votre mot de passe",
"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",
"pwdChanged":"Votre mot de passe a été changé.",
"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",
"yourLoginIs":"Votre identifiant est"
}
......@@ -83,6 +83,7 @@ sub MIME::Lite::send {
ok( $mail->header_as_string =~ /dwho\@badwolf.org/s, ' Found dest' )
or explain( $mail->header_as_string, 'To: dwho@badwolf.org' );
count(2);
print STDERR $mail->header_as_string."\n";
unless ($mail2) {
$mailSend = 1;
ok(
......
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