2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
4 /*********************************************************************************
5 * SugarCRM is a customer relationship management program developed by
6 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU Affero General Public License version 3 as published by the
10 * Free Software Foundation with the addition of the following permission added
11 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
12 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
13 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
20 * You should have received a copy of the GNU Affero General Public License along with
21 * this program; if not, see http://www.gnu.org/licenses or write to the Free
22 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
26 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
28 * The interactive user interfaces in modified source and object code versions
29 * of this program must display Appropriate Legal Notices, as required under
30 * Section 5 of the GNU Affero General Public License version 3.
32 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
33 * these Appropriate Legal Notices must retain the display of the "Powered by
34 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
35 * technical reasons, the Appropriate Legal Notices must display the words
36 * "Powered by SugarCRM".
37 ********************************************************************************/
39 require('config.php');
43 //Sent when the admin generate a new password
44 $EmailTemp = new EmailTemplate();
45 $subj ='New account information';
46 $desc = 'This template is used when the System Administrator sends a new password to a user.';
47 $body = '<div><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width="550" align=\"\"\"center\"\"\"><tbody><tr><td colspan=\"2\"><p>Here is your account username and temporary password:</p><p>Username : $contact_user_user_name </p><p>Password : $contact_user_user_hash </p><br><p>'.$GLOBALS['sugar_config']['site_url'].'/index.php</p><br><p>After you log in using the above password, you may be required to reset the password to one of your own choice.</p> </td> </tr><tr><td colspan=\"2\"></td> </tr> </tbody></table> </div>';
50 Here is your account username and temporary password:
51 Username : $contact_user_user_name
52 Password : $contact_user_user_hash
54 '.$GLOBALS['sugar_config']['site_url'].'/index.php
56 After you log in using the above password, you may be required to reset the password to one of your own choice.';
57 $name = 'System-generated password email';
59 $EmailTemp->name = $name;
60 $EmailTemp->description = $desc;
61 $EmailTemp->subject = $subj;
62 $EmailTemp->body = $txt_body;
63 $EmailTemp->body_html = $body;
64 $EmailTemp->deleted = 0;
65 $EmailTemp->published = 'off';
66 $EmailTemp->text_only = 0;
67 $id =$EmailTemp->save();
69 $sugar_config['passwordsetting']['generatepasswordtmpl'] = $id;
70 $sugar_config['passwordsetting']['forgotpasswordON'] = true;
71 $sugar_config['passwordsetting']['SystemGeneratedPasswordON'] = true;
72 $sugar_config['passwordsetting']['systexpirationtime'] = 7;
73 $sugar_config['passwordsetting']['systexpiration'] = 1;
74 $sugar_config['passwordsetting']['linkexpiration'] = true;
75 $sugar_config['passwordsetting']['linkexpirationtime'] = 24;
76 $sugar_config['passwordsetting']['linkexpirationtype'] = 60;
77 $sugar_config['passwordsetting']['minpwdlength'] = 6;
78 $sugar_config['passwordsetting']['oneupper'] = true;
79 $sugar_config['passwordsetting']['onelower'] = true;
80 $sugar_config['passwordsetting']['onenumber'] = true;
82 $result = $EmailTemp->db->query("INSERT INTO config (value, category, name) VALUES ('$id','password', 'System-generated password email')");
85 //User generate a link to set a new password
86 $EmailTemp = new EmailTemplate();
87 $subj ='Reset your account password';
88 $desc = "This template is used to send a user a link to click to reset the user's account password.";
89 $body = '<div><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width="550" align=\"\"\"center\"\"\"><tbody><tr><td colspan=\"2\"><p>You recently requested on $contact_user_pwd_last_changed to be able to reset your account password. </p><p>Click on the link below to reset your password:</p><p> $contact_user_link_guid </p> </td> </tr><tr><td colspan=\"2\"></td> </tr> </tbody></table> </div>';
92 You recently requested on $contact_user_pwd_last_changed to be able to reset your account password.
94 Click on the link below to reset your password:
96 $contact_user_link_guid';
97 $name = 'Forgot Password email';
99 $EmailTemp->name = $name;
100 $EmailTemp->description = $desc;
101 $EmailTemp->subject = $subj;
102 $EmailTemp->body = $txt_body;
103 $EmailTemp->body_html = $body;
104 $EmailTemp->deleted = 0;
105 $EmailTemp->published = 'off';
106 $EmailTemp->text_only = 0;
107 $id =$EmailTemp->save();
108 $sugar_config['passwordsetting']['lostpasswordtmpl'] = $id;
110 $result = $EmailTemp->db->query("INSERT INTO config (value, category, name) VALUES ('$id','password', 'Forgot Password email')");
112 //rebuildConfigFile($sugar_config, $sugar_config['sugar_version']);
113 write_array_to_file( "sugar_config", $sugar_config, "config.php");