|
34 | 34 | $v_email = escapeshellarg($_POST['v_email']); |
35 | 35 | $v_fname = escapeshellarg($_POST['v_fname']); |
36 | 36 | $v_lname = escapeshellarg($_POST['v_lname']); |
| 37 | + if (empty($_POST['v_notify'])) $v_notify = 'off'; |
37 | 38 |
|
38 | 39 | // Check for errors |
39 | 40 | if (!empty($errors[0])) { |
|
52 | 53 | if (empty($error)) $error = 'Error: vesta did not return any output.'; |
53 | 54 | $_SESSION['error_msg'] = $error; |
54 | 55 | } else { |
| 56 | + if (empty($v_notify)) { |
| 57 | + $to = $_POST['v_email']; |
| 58 | + $subject = "Welcome to Vesta Control Panel"; |
| 59 | + $hostname = exec('hostname'); |
| 60 | + $from = "Vesta Control Panel <noreply@".$hostname.">"; |
| 61 | + if (!empty($_POST['v_fname'])) { |
| 62 | + $mailtext = "Hello ".$_POST['v_fname']." ".$_POST['v_lname'].",\n"; |
| 63 | + } else { |
| 64 | + $mailtext = "Hello,\n"; |
| 65 | + } |
| 66 | + $mailtext .= "Your account has been created successfully and is ready to use.\n\n"; |
| 67 | + $mailtext .= "https://".$_SERVER['HTTP_HOST']."/login/\n"; |
| 68 | + $mailtext .= "username: ".$_POST['v_username']."\n"; |
| 69 | + $mailtext .= "password: ".$_POST['v_password']."\n\n"; |
| 70 | + $mailtext .= "Have a nice day,\nThe VestaCP Team\n"; |
| 71 | + send_email($to, $subject, $mailtext, $from); |
| 72 | + } |
| 73 | + |
55 | 74 | $_SESSION['ok_msg'] = "OK: user <b>".$_POST[v_username]."</b> has been created successfully."; |
56 | 75 | unset($v_username); |
57 | 76 | unset($v_password); |
|
63 | 82 | } |
64 | 83 | } |
65 | 84 |
|
66 | | - |
67 | 85 | exec (VESTA_CMD."v_list_user_packages json", $output, $return_var); |
68 | 86 | check_error($return_var); |
69 | 87 | $data = json_decode(implode('', $output), true); |
|
0 commit comments