2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
40 * Description: TODO: To be written.
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42 * All Rights Reserved.
43 * Contributor(s): ______________________________________..
44 ********************************************************************************/
47 if (isset($_POST['saveConfig'])){
48 require_once('modules/Users/User.php');
50 $focus->retrieve($_POST['record']);
51 if(!$focus->change_password($_POST['old_password'], $_POST['new_password']))
52 SugarApplication::redirect("index.php?action=ChangePassword&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string));
54 // Send to new user wizard if it hasn't been run
55 $ut = $GLOBALS['current_user']->getPreference('ut');
57 SugarApplication::redirect('index.php?module=Users&action=Wizard');
59 // Otherwise, send to home page
60 SugarApplication::redirect('index.php?module=Home&action=index');
63 require_once('modules/Administration/Forms.php');
64 require_once('modules/Configurator/Configurator.php');
65 $configurator = new Configurator();
66 $sugarConfig = SugarConfig::getInstance();
69 require_once('include/SugarLogger/SugarLogger.php');
70 $sugar_smarty = new Sugar_Smarty();
71 $sugar_smarty->assign('MOD', $mod_strings);
72 $sugar_smarty->assign('APP', $app_strings);
73 $sugar_smarty->assign('MODULE', 'Users');
74 $sugar_smarty->assign('ACTION', 'ChangePassword');
75 $sugar_smarty->assign('return_action', 'index');
76 $sugar_smarty->assign('APP_LIST', $app_list_strings);
77 $sugar_smarty->assign('config', $configurator->config);
78 $sugar_smarty->assign('error', $configurator->errors);
79 $sugar_smarty->assign('LANGUAGES', get_languages());
80 $sugar_smarty->assign('PWDSETTINGS', $GLOBALS['sugar_config']['passwordsetting']);
81 $sugar_smarty->assign('ID', $current_user->id);
82 $sugar_smarty->assign('IS_ADMIN', $current_user->is_admin);
83 $sugar_smarty->assign('USER_NAME', $current_user->user_name);
84 $sugar_smarty->assign("INSTRUCTION", $mod_strings['LBL_CHANGE_SYSTEM_PASSWORD']);
85 $sugar_smarty->assign('sugar_md',getWebPath('include/images/sugar_md_open.png'));
86 if (!$current_user->is_admin) $sugar_smarty->assign('OLD_PASSWORD_FIELD','<td scope="row" width="30%">'.$mod_strings['LBL_OLD_PASSWORD'].':</td><td width="70%"><input type="password" size="26" tabindex="1" id="old_password" name="old_password" value="" /></td>');
87 $pwd_settings=$GLOBALS['sugar_config']['passwordsetting'];
91 $sugar_smarty->assign('SUBMIT_BUTTON',
92 '<input title="'.$app_strings['LBL_SAVE_BUTTON_TITLE'].'" class="button" '
93 . 'onclick="if (!set_password(form,newrules(' . $rules . '))) return false; this.form.saveConfig.value=\'1\';" '
94 . 'type="submit" name="button" value="'.$app_strings['LBL_SAVE_BUTTON_LABEL'].'" />');
97 if (isset($_SESSION['expiration_type']) && $_SESSION['expiration_type'] != '')
98 $sugar_smarty->assign('EXPIRATION_TYPE', $_SESSION['expiration_type']);/*
99 if ($current_user->system_generated_password == '1')
100 $sugar_smarty->assign('EXPIRATION_TYPE', $mod_strings['LBL_PASSWORD_EXPIRATION_GENERATED']);*/
101 if(isset($_REQUEST['error_password'])) $sugar_smarty->assign('EXPIRATION_TYPE', $_REQUEST['error_password']);
102 $sugar_smarty->display('modules/Users/Changenewpassword.tpl');