mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 21:04:06 -07:00
Sending mail credentials to email
This commit is contained in:
parent
a68dce9bec
commit
8c1deb80f7
4 changed files with 64 additions and 7 deletions
|
@ -94,15 +94,25 @@ if (!empty($_POST['ok_acc'])) {
|
||||||
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
|
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate email
|
||||||
|
if ((!empty($_POST['v_send_email'])) && (empty($_SESSION['error_msg']))) {
|
||||||
|
if (!filter_var($_POST['v_send_email'], FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$_SESSION['error_msg'] = __('Please enter valid email address.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Protect input
|
// Protect input
|
||||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||||
$v_domain = strtolower($v_domain);
|
$v_domain = strtolower($v_domain);
|
||||||
$v_account = escapeshellarg($_POST['v_account']);
|
$v_account = escapeshellarg($_POST['v_account']);
|
||||||
$v_quota = escapeshellarg($_POST['v_quota']);
|
$v_quota = escapeshellarg($_POST['v_quota']);
|
||||||
|
$v_send_email = $_POST['v_send_email'];
|
||||||
|
$v_credentials = $_POST['v_credentials'];
|
||||||
$v_aliases = $_POST['v_aliases'];
|
$v_aliases = $_POST['v_aliases'];
|
||||||
$v_fwd = $_POST['v_fwd'];
|
$v_fwd = $_POST['v_fwd'];
|
||||||
if (empty($_POST['v_quota'])) $v_quota = 0;
|
if (empty($_POST['v_quota'])) $v_quota = 0;
|
||||||
if ((!empty($_POST['v_quota'])) || (!empty($_POST['v_aliases'])) || (!empty($_POST['v_fwd'])) ) $v_adv = 'yes';
|
if ((!empty($_POST['v_quota'])) || (!empty($_POST['v_aliases'])) || (!empty($_POST['v_fwd'])) ) $v_adv = 'yes';
|
||||||
|
$v_quota = escapeshellarg($_POST['v_quota']);
|
||||||
|
|
||||||
// Add Mail Account
|
// Add Mail Account
|
||||||
if (empty($_SESSION['error_msg'])) {
|
if (empty($_SESSION['error_msg'])) {
|
||||||
|
@ -165,6 +175,16 @@ if (!empty($_POST['ok_acc'])) {
|
||||||
if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
|
if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Email login credentials
|
||||||
|
if ((!empty($v_send_email)) && (empty($_SESSION['error_msg']))) {
|
||||||
|
$to = $v_send_email;
|
||||||
|
$subject = __("Email Credentials");
|
||||||
|
$hostname = exec('hostname');
|
||||||
|
$from = __('MAIL_FROM', $hostname);
|
||||||
|
$mailtext = $v_credentials;
|
||||||
|
send_email($to, $subject, $mailtext, $from);
|
||||||
|
}
|
||||||
|
|
||||||
// Flush field values on success
|
// Flush field values on success
|
||||||
if (empty($_SESSION['error_msg'])) {
|
if (empty($_SESSION['error_msg'])) {
|
||||||
$_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]));
|
$_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]));
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/');
|
define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/');
|
||||||
define('JS_LATEST_UPDATE', '1476144160');
|
define('JS_LATEST_UPDATE', '1491697866');
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
|
|
@ -90,14 +90,37 @@ randomString = function() {
|
||||||
$('#v_password').text(randomstring);
|
$('#v_password').text(randomstring);
|
||||||
else
|
else
|
||||||
$('#v_password').text(Array(randomstring.length+1).join('*'));
|
$('#v_password').text(Array(randomstring.length+1).join('*'));
|
||||||
|
generate_mail_credentials();
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_mail_credentials = function() {
|
||||||
|
var div = $('.mail-infoblock').clone();
|
||||||
|
div.find('#mail_configuration').remove();
|
||||||
|
var pass=div.find('#v_password').text();
|
||||||
|
if (pass=="") div.find('#v_password').html(' ');
|
||||||
|
var output = div.text();
|
||||||
|
output=output.replace(/(?:\r\n|\r|\n|\t)/g, "|");
|
||||||
|
output=output.replace(/ /g, "");
|
||||||
|
output=output.replace(/\|\|/g, "|");
|
||||||
|
output=output.replace(/\|\|/g, "|");
|
||||||
|
output=output.replace(/\|\|/g, "|");
|
||||||
|
output=output.replace(/^\|+/g, "");
|
||||||
|
output=output.replace(/\|$/, "");
|
||||||
|
output=output.replace(/ $/, "");
|
||||||
|
output=output.replace(/:\|/g, ": ");
|
||||||
|
output=output.replace(/\|/g, "\n");
|
||||||
|
//console.log(output);
|
||||||
|
$('#v_credentials').val(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#v_account').text($('input[name=v_account]').val());
|
$('#v_account').text($('input[name=v_account]').val());
|
||||||
$('#v_password').text($('input[name=v_password]').val());
|
$('#v_password').text($('input[name=v_password]').val());
|
||||||
|
generate_mail_credentials();
|
||||||
|
|
||||||
$('input[name=v_account]').change(function(){
|
$('input[name=v_account]').change(function(){
|
||||||
$('#v_account').text($(this).val());
|
$('#v_account').text($(this).val());
|
||||||
|
generate_mail_credentials();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input[name=v_password]').change(function(){
|
$('input[name=v_password]').change(function(){
|
||||||
|
@ -105,6 +128,7 @@ $(document).ready(function() {
|
||||||
$('#v_password').text($(this).val());
|
$('#v_password').text($(this).val());
|
||||||
else
|
else
|
||||||
$('#v_password').text(Array($(this).val().length+1).join('*'));
|
$('#v_password').text(Array($(this).val().length+1).join('*'));
|
||||||
|
generate_mail_credentials();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.toggle-psw-visibility-icon').click(function(){
|
$('.toggle-psw-visibility-icon').click(function(){
|
||||||
|
@ -112,6 +136,7 @@ $(document).ready(function() {
|
||||||
$('#v_password').text($('input[name=v_password]').val());
|
$('#v_password').text($('input[name=v_password]').val());
|
||||||
else
|
else
|
||||||
$('#v_password').text(Array($('input[name=v_password]').val().length+1).join('*'));
|
$('#v_password').text(Array($('input[name=v_password]').val().length+1).join('*'));
|
||||||
|
generate_mail_credentials();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#mail_configuration').change(function(evt){
|
$('#mail_configuration').change(function(evt){
|
||||||
|
@ -144,5 +169,6 @@ $(document).ready(function() {
|
||||||
$('#td_smtp_encryption').html(opt.attr('no_encryption'));
|
$('#td_smtp_encryption').html(opt.attr('no_encryption'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
generate_mail_credentials();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -118,6 +118,17 @@
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="vst-text input-label">
|
||||||
|
<?php print __('Send login credentials to email address') ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input type="text" class="vst-input" name="v_send_email" value="<?=htmlentities(trim($v_send_email, "'"))?>">
|
||||||
|
<input type="hidden" name="v_credentials" id="v_credentials">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table class="data-col2">
|
<table class="data-col2">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue