mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 21:04:06 -07:00
Send email on user changed ftp user password
This commit is contained in:
parent
efc777aff1
commit
e9be41692c
4 changed files with 45 additions and 10 deletions
|
@ -551,6 +551,13 @@ if (!empty($_POST['save'])) {
|
|||
exec (VESTA_CMD."v-change-web-domain-ftp-path ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_path, $output, $return_var);
|
||||
if ($v_ftp_user_data['v_ftp_password'] != "'••••••••'" && $v_ftp_user_data['v_ftp_password'] != "••••••••" && !empty($v_ftp_user_data['v_ftp_password'])) {
|
||||
exec (VESTA_CMD."v-change-web-domain-ftp-password ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_user_data['v_ftp_password'], $output, $return_var);
|
||||
$to = $v_ftp_user_data['v_ftp_email'];
|
||||
$subject = __("FTP login credentials");
|
||||
$hostname = exec('hostname');
|
||||
$from = __('MAIL_FROM',$hostname);
|
||||
$mailtext = __('FTP_ACCOUNT_READY',$_GET['domain'],$user,$v_ftp_username,$v_ftp_user_data['v_ftp_password']);
|
||||
send_email($to, $subject, $mailtext, $from);
|
||||
unset($v_ftp_email);
|
||||
}
|
||||
check_return_code($return_var, $output);
|
||||
unset($output);
|
||||
|
|
|
@ -84,8 +84,8 @@ App.Actions.WEB.add_ftp_user_form = function() {
|
|||
var index = $('.data-col2 .ftptable').length + 1;
|
||||
|
||||
ref.find('input').each(function(i, elm) {
|
||||
var attr_value = $(elm).attr('name').replace('%INDEX%', index);
|
||||
$(elm).attr('name', attr_value);
|
||||
var attr_value = $(elm).prop('name').replace('%INDEX%', index);
|
||||
$(elm).prop('name', attr_value);
|
||||
});
|
||||
|
||||
ref.find('.ftp-user-number').text(index);
|
||||
|
@ -141,8 +141,8 @@ App.Actions.WEB.toggle_additional_ftp_accounts = function(elm) {
|
|||
var index = $('.data-col2 .ftptable').length + 1;
|
||||
|
||||
ref.find('input').each(function(i, elm) {
|
||||
var attr_value = $(elm).attr('name').replace('%INDEX%', index);
|
||||
$(elm).attr('name', attr_value);
|
||||
var attr_value = $(elm).prop('name').replace('%INDEX%', index);
|
||||
$(elm).prop('name', attr_value);
|
||||
});
|
||||
|
||||
ref.find('.ftp-user-number').text(index);
|
||||
|
|
|
@ -74,8 +74,8 @@ App.Actions.WEB.add_ftp_user_form = function() {
|
|||
var index = $('.data-col2 .ftptable').length + 1;
|
||||
|
||||
ref.find('input').each(function(i, elm) {
|
||||
var attr_value = $(elm).attr('name').replace('%INDEX%', index);
|
||||
$(elm).attr('name', attr_value);
|
||||
var attr_value = $(elm).prop('name').replace('%INDEX%', index);
|
||||
$(elm).prop('name', attr_value);
|
||||
});
|
||||
|
||||
ref.find('.ftp-user-number').text(index);
|
||||
|
@ -132,7 +132,34 @@ App.Actions.WEB.toggle_additional_ftp_accounts = function(elm) {
|
|||
}
|
||||
}
|
||||
|
||||
App.Actions.WEB.randomPasswordGenerated = function(elm) {
|
||||
return App.Actions.WEB.passwordChanged(elm);
|
||||
}
|
||||
|
||||
App.Actions.WEB.passwordChanged = function(elm) {
|
||||
var ref = $(elm).parents('.ftptable');
|
||||
if (ref.find('.vst-email-alert-on-psw').length == 0) {
|
||||
var inp_name = ref.find('.v-ftp-user-is-new').prop('name');
|
||||
inp_name = inp_name.replace('is_new', 'v_ftp_email');
|
||||
ref.find('tr:last').after('<tr>\
|
||||
<td class="vst-text step-left input-label">\
|
||||
Send FTP credentials to email\
|
||||
</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="step-left">\
|
||||
<input type="text" value="" name="' + inp_name + '" class="vst-input vst-email-alert-on-psw">\
|
||||
</td>\
|
||||
</tr>');
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Page entry point
|
||||
App.Listeners.WEB.keypress_ftp_username();
|
||||
App.Listeners.WEB.keypress_ftp_path();
|
||||
|
||||
$('.v-ftp-user-psw').on('keypress', function(evt) {
|
||||
var elm = $(evt.target);
|
||||
App.Actions.WEB.passwordChanged(elm);
|
||||
});
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
}
|
||||
|
||||
$(elm).parents('.ftptable').find('.v-ftp-user-psw').val(ftprandomstring);
|
||||
App.Actions.WEB.randomPasswordGenerated && App.Actions.WEB.randomPasswordGenerated(elm);
|
||||
}
|
||||
|
||||
function elementHideShow(elementToHideOrShow){
|
||||
|
@ -316,7 +317,7 @@
|
|||
<table style="display:<?php if (empty($v_ftp_user)) { echo 'none';} else {echo 'block';}?> ;" class="ftptable ftptable-nrm" name="v_add_domain_ftp">
|
||||
<tr>
|
||||
<td class="vst-text input-label">
|
||||
<?php print __('FTP') ?> #<span class="ftp-user-number"><?php print $i + 1; ?></span> <a class="ftp-remove-user additional-control do_delete" onCLick="App.Actions.WEB.remove_ftp_user(this)">(<?php print __('delete') ?>)</a>
|
||||
<?php print __('FTP') ?> #<span class="ftp-user-number"><?php print $i + 1; ?></span> <a class="ftp-remove-user additional-control" onCLick="App.Actions.WEB.remove_ftp_user(this)">(<?php print __('remove') ?>)</a>
|
||||
<input type="hidden" class="v-ftp-user-deleted" name="v_ftp_user[<?php print $i ?>][delete]" value="0" />
|
||||
<input type="hidden" class="v-ftp-user-is-new" name="v_ftp_user[<?php print $i ?>][is_new]" value="<?php print $ftp_user['is_new'] ?>" />
|
||||
</td>
|
||||
|
@ -364,7 +365,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="step-left">
|
||||
<input type="text" class="vst-input" name="v_ftp_user[<?php print $i ?>][v_ftp_email]" <?php if (!empty($v_ftp_email)) echo "value=".$v_ftp_email; ?>>
|
||||
<input type="text" class="vst-input vst-email-alert-on-psw" name="v_ftp_user[<?php print $i ?>][v_ftp_email]" <?php if (!empty($v_ftp_email)) echo "value=".$v_ftp_email; ?>>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
@ -398,7 +399,7 @@
|
|||
<table class="ftptable ftptable-nrm" name="v_add_domain_ftp">
|
||||
<tr>
|
||||
<td class="vst-text input-label">
|
||||
<?php print __('FTP') ?> #<span class="ftp-user-number"></span> <a class="ftp-remove-user additional-control do_delete" onCLick="App.Actions.WEB.remove_ftp_user(this)">(<?php print __('delete') ?>)</a>
|
||||
<?php print __('FTP') ?> #<span class="ftp-user-number"></span> <a class="ftp-remove-user additional-control" onCLick="App.Actions.WEB.remove_ftp_user(this)">(<?php print __('remove') ?>)</a>
|
||||
<input type="hidden" class="v-ftp-user-deleted" name="v_ftp_user[%INDEX%][delete]" value="0" />
|
||||
<input type="hidden" class="v-ftp-user-is-new" name="v_ftp_user[%INDEX%][is_new]" value="1" />
|
||||
</td>
|
||||
|
@ -445,7 +446,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="step-left">
|
||||
<input type="text" class="vst-input" name="v_ftp_user[%INDEX%][v_ftp_email]" value="">
|
||||
<input type="text" class="vst-input vst-email-alert-on-psw" name="v_ftp_user[%INDEX%][v_ftp_email]" value="">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue