5
* ZPanel - A Cross-Platform Open-Source Web Hosting Control panel.
9
* @author Bobby Allen - ballen@zpanelcp.com
10
* @copyright (c) 2008-2011 ZPanel Group - http://www.zpanelcp.com/
11
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License v3
13
* This program (ZPanel) is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation, either version 3 of the License, or
16
* (at your option) any later version.
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
27
class module_controller {
32
static function doUpdatePassword() {
36
$currentuser = ctrl_users::GetUserDetail();
38
$current_pass = $controller->GetControllerRequest('FORM', 'inCurPass');
39
$newpass = $controller->GetControllerRequest('FORM', 'inNewPass');
40
$conpass = $controller->GetControllerRequest('FORM', 'inConPass');
42
if (fs_director::CheckForEmptyValue($newpass)) {
43
// Current password is blank!
44
self::$error = "error";
45
} elseif (md5($current_pass) <> $currentuser['password']) {
46
// Current password does not match!
47
self::$error = "error";
49
if ($newpass == $conpass) {
50
// Check for password length...
51
if (strlen($newpass) < ctrl_options::GetOption('password_minlength')) {
52
self::$badpassword = true;
55
// Check that the new password matches the confirmation box.
56
$sql = $zdbh->prepare("UPDATE x_accounts SET ac_pass_vc='" . md5($newpass) . "' WHERE ac_id_pk=" . $currentuser['userid'] . "");
60
self::$error = "error";
65
static function getResult() {
66
if (!fs_director::CheckForEmptyValue(self::$error)) {
67
if (self::$error == "ok") {
68
return ui_sysmessage::shout(ui_language::translate("Your account password been changed successfully!"), "zannounceok");
70
if (self::$error == "error") {
71
return ui_sysmessage::shout(ui_language::translate("An error occured and your ZPanel account password could not be updated. Please ensure you entered all passwords correctly and try again."), "zannounceerror");
74
if (!fs_director::CheckForEmptyValue(self::$badpassword)) {
75
return ui_sysmessage::shout(ui_language::translate("Your password did not meet the minimun length requirements. Characters needed for password length") .": " . ctrl_options::GetOption('password_minlength'), "zannounceerror");
81
static function getModuleName() {
82
$module_name = ui_module::GetModuleName();
86
static function getModuleIcon() {
88
$module_icon = "modules/" . $controller->GetControllerRequest('URL', 'module') . "/assets/icon.png";
92
static function UpdatePassword($uid, $password) {
94
$sql = $zdbh->prepare("UPDATE x_accounts SET ac_pass_vc='" . md5($password) . "' WHERE ac_id_pk=$uid");
99
static function getModuleDesc() {
100
$message = ui_language::translate(ui_module::GetModuleDescription());