mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
Sending mail credentials to email [edit form]
This commit is contained in:
parent
930a2a82e3
commit
9347c2aa04
4 changed files with 57 additions and 1 deletions
|
@ -179,8 +179,17 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||||
$v_account = escapeshellarg($_POST['v_account']);
|
$v_account = escapeshellarg($_POST['v_account']);
|
||||||
|
$v_send_email = $_POST['v_send_email'];
|
||||||
|
$v_credentials = $_POST['v_credentials'];
|
||||||
|
|
||||||
// Change password
|
// Change password
|
||||||
if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
|
if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
|
||||||
|
@ -297,6 +306,16 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
// Set success message
|
// Set success message
|
||||||
if (empty($_SESSION['error_msg'])) {
|
if (empty($_SESSION['error_msg'])) {
|
||||||
$_SESSION['ok_msg'] = __('Changes has been saved.');
|
$_SESSION['ok_msg'] = __('Changes has been saved.');
|
||||||
|
|
|
@ -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', '1491697866');
|
define('JS_LATEST_UPDATE', '1491697867');
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
|
|
@ -91,14 +91,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(){
|
||||||
|
@ -106,6 +129,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(){
|
||||||
|
@ -113,6 +137,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){
|
||||||
|
@ -145,5 +170,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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -125,6 +125,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