Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
Open sidebar
ISPConfig
ISPConfig 3
Commits
d36ffac1
Unverified
Commit
d36ffac1
authored
Mar 27, 2022
by
Helmo
Browse files
Rewrite email sending to use ispcmail, and translate
parent
8eaa875b
Changes
2
Hide whitespace changes
Inline
Side-by-side
interface/web/login/lib/lang/en.lng
View file @
d36ffac1
...
...
@@ -36,5 +36,7 @@ $wb['otp_code_txt'] = 'Two Factor Authentication';
$wb
[
'otp_code_desc_txt'
]
=
'Enter the code you got from your authenticator app or via email.'
;
$wb
[
'otp_code_placeholder_txt'
]
=
'OTP code'
;
$wb
[
'otp_code_email_sent_txt'
]
=
'An email was sent to'
;
$wb
[
'otp_code_email_subject_txt'
]
=
'ISPConfig Login authentication'
;
$wb
[
'otp_code_email_template_txt'
]
=
'Your One time login code is %s'
.
PHP_EOL
.
'This code is valid for 10 minutes.'
.
PHP_EOL
;
$wb
[
'otp_code_resend_txt'
]
=
'Request new code'
;
?>
interface/web/login/otp.php
View file @
d36ffac1
...
...
@@ -142,16 +142,21 @@ if($_SESSION['otp']['type'] == 'email') {
$app
->
uses
(
'functions'
);
$app
->
uses
(
'getconf'
);
$system_config
=
$app
->
getconf
->
get_global_config
();
$from
=
$system_config
[
'mail'
][
'admin_mail'
];
$server_config_array
=
$app
->
getconf
->
get_global_config
();
//* send email
$app
->
uses
(
'getconf,ispcmail'
);
$mail_config
=
$server_config_array
[
'mail'
];
if
(
$mail_config
[
'smtp_enabled'
]
==
'y'
)
{
$mail_config
[
'use_smtp'
]
=
true
;
$app
->
ispcmail
->
setOptions
(
$mail_config
);
}
$email_to
=
$_SESSION
[
'otp'
][
'data'
];
$subject
=
'ISPConfig Login authentication'
;
$text
=
'Your One time login code is '
.
$new_otp_code
.
PHP_EOL
.
'This code is valid for 10 minutes'
.
PHP_EOL
;
$app
->
ispcmail
->
setSender
(
$mail_config
[
'admin_mail'
],
$mail_config
[
'admin_name'
]);
$app
->
ispcmail
->
setSubject
(
$wb
[
'otp_code_email_subject_txt'
]);
$app
->
ispcmail
->
setMailText
(
sprintf
(
$wb
[
'otp_code_email_template_txt'
],
$new_otp_code
));
$send_result
=
$app
->
ispcmail
->
send
(
$email_to
);
$app
->
ispcmail
->
finish
();
$app
->
functions
->
mail
(
$email_to
,
$subject
,
$text
,
$from
);
//* increase sent counter
if
(
!
isset
(
$_SESSION
[
'otp'
][
'sent'
]))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment