renderError('General error'); } $key = addslashes(htmlspecialchars($_GET['v'])); $cmd = Config::get('sudo_path')." ".Config::get('vesta_functions_path').Vesta::V_LIST_SYS_USERS." 'json'"; exec($cmd, $output, $return); $users = json_decode(implode('', $output), true); $email_matched_count = array(); foreach ($users as $username => $user) { if ($user['RKEY'] == trim($key)) { $email_matched_count[] = array_merge(array('USERNAME' => $username), $user); } } if (isset($_POST['action']) && $_POST['action'] == 'change') { return $this->doChangePassword($email_matched_count); } return $this->showResetForm(); } protected function doChangePassword($users) { if ($_POST['secret_code'] != $_POST['confirm_secret_code']) { return $this->showResetForm('Passwords don\'t match'); } if (strlen($_POST['secret_code']) < 6) { return $this->showResetForm('Passwords is too short'); } if (strlen($_POST['secret_code']) > 255) { return $this->showResetForm('Passwords is too long'); } $success = true; foreach ($users as $user) { $cmd = Config::get('sudo_path')." ".Config::get('vesta_functions_path').Vesta::V_CHANGE_SYS_USER_PASSWORD." ".$user['USERNAME']." ".$_POST['secret_code']; exec($cmd, $output, $return); if (!$return) { $success = false; } } if (!$success) { $main = new MAIN(); $about = json_decode($main->aboutExecute(), TRUE); return $this->showResetForm('Something went wrong. Please contact support: '.$about['data']['company_email']); } return $this->showSuccessTpl(); } public function showSuccessTpl() { $main = new MAIN(); $about = json_decode($main->aboutExecute(), TRUE); $current_year = date("Y"); print <<
For questions please contact {$about['data']['company_email']}
© {$current_year} Vesta Control PanelFor questions please contact {$about['data']['company_email']}
© {$current_year} Vesta Control Panel