2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2012 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 ********************************************************************************/
45 if (isset($_SESSION['authenticated_user_id']))
48 // fixing bug #46837: Previosly links/URLs to records in Sugar from MSO Excel/Word were referred to the home screen and not the record
49 // It used to appear when default browser was not MS IE
50 header("Location: ".$GLOBALS['app']->getLoginRedirect());
54 global $current_language, $mod_strings, $app_strings;
55 if(isset($_REQUEST['login_language'])){
56 $lang = $_REQUEST['login_language'];
57 $_REQUEST['ck_login_language_20'] = $lang;
58 $current_language = $lang;
59 $_SESSION['authenticated_user_language'] = $lang;
60 $mod_strings = return_module_language($lang, "Users");
61 $app_strings = return_application_language($lang);
63 $sugar_smarty = new Sugar_Smarty();
64 echo '<link rel="stylesheet" type="text/css" media="all" href="'.getJSPath('modules/Users/login.css').'">';
65 echo '<script type="text/javascript" src="'.getJSPath('modules/Users/login.js').'"></script>';
66 global $app_language, $sugar_config;
67 //we don't want the parent module's string file, but rather the string file specifc to this subpanel
68 global $current_language;
70 // Get the login page image
71 if ( sugar_is_file('custom/include/images/sugar_md.png') ) {
72 $login_image = '<IMG src="custom/include/images/sugar_md.png" alt="Sugar" width="340" height="25">';
75 $login_image = '<IMG src="include/images/sugar_md_open.png" alt="Sugar" width="340" height="25" style="margin: 5px 0;">';
77 $sugar_smarty->assign('LOGIN_IMAGE',$login_image);
79 // See if any messages were passed along to display to the user.
80 if(isset($_COOKIE['loginErrorMessage'])) {
81 if ( !isset($_REQUEST['loginErrorMessage']) ) {
82 $_REQUEST['loginErrorMessage'] = $_COOKIE['loginErrorMessage'];
84 SugarApplication::setCookie('loginErrorMessage', '', time()-42000, '/');
86 if(isset($_REQUEST['loginErrorMessage'])) {
87 if (isset($mod_strings[$_REQUEST['loginErrorMessage']])) {
88 echo "<p align='center' class='error' > ". $mod_strings[$_REQUEST['loginErrorMessage']]. "</p>";
89 } else if (isset($app_strings[$_REQUEST['loginErrorMessage']])) {
90 echo "<p align='center' class='error' > ". $app_strings[$_REQUEST['loginErrorMessage']]. "</p>";
94 $lvars = $GLOBALS['app']->getLoginVars();
95 $sugar_smarty->assign("LOGIN_VARS", $lvars);
96 foreach($lvars as $k => $v) {
97 $sugar_smarty->assign(strtoupper($k), $v);
100 // Retrieve username from the session if possible.
101 if(isset($_SESSION["login_user_name"])) {
102 if (isset($_REQUEST['default_user_name']))
103 $login_user_name = $_REQUEST['default_user_name'];
105 $login_user_name = $_SESSION['login_user_name'];
107 if(isset($_REQUEST['default_user_name'])) {
108 $login_user_name = $_REQUEST['default_user_name'];
109 } elseif(isset($_REQUEST['ck_login_id_20'])) {
110 $login_user_name = get_user_name($_REQUEST['ck_login_id_20']);
112 $login_user_name = $sugar_config['default_user_name'];
114 $_SESSION['login_user_name'] = $login_user_name;
116 $sugar_smarty->assign('LOGIN_USER_NAME', $login_user_name);
118 $mod_strings['VLD_ERROR'] = $GLOBALS['app_strings']["\x4c\x4f\x47\x49\x4e\x5f\x4c\x4f\x47\x4f\x5f\x45\x52\x52\x4f\x52"];
120 // Retrieve password from the session if possible.
121 if(isset($_SESSION["login_password"])) {
122 $login_password = $_SESSION['login_password'];
124 $login_password = $sugar_config['default_password'];
125 $_SESSION['login_password'] = $login_password;
127 $sugar_smarty->assign('LOGIN_PASSWORD', $login_password);
129 if(isset($_SESSION["login_error"])) {
130 $sugar_smarty->assign('LOGIN_ERROR', $_SESSION['login_error']);
132 if(isset($_SESSION["waiting_error"])) {
133 $sugar_smarty->assign('WAITING_ERROR', $_SESSION['waiting_error']);
136 if (isset($_REQUEST['ck_login_language_20'])) {
137 $display_language = $_REQUEST['ck_login_language_20'];
139 $display_language = $sugar_config['default_language'];
142 if (empty($GLOBALS['sugar_config']['passwordsetting']['forgotpasswordON']))
143 $sugar_smarty->assign('DISPLAY_FORGOT_PASSWORD_FEATURE','none');
145 $the_languages = get_languages();
146 if ( count($the_languages) > 1 )
147 $sugar_smarty->assign('SELECT_LANGUAGE', get_select_options_with_id($the_languages, $display_language));
148 $the_themes = SugarThemeRegistry::availableThemes();
149 if ( !empty($logindisplay) )
150 $sugar_smarty->assign('LOGIN_DISPLAY', $logindisplay);;
154 $admin = new Administration();
155 $admin->retrieveSettings('captcha');
156 $captcha_privatekey = "";
157 $captcha_publickey="";
161 // if the admin set the captcha stuff, assign javascript and div
162 if(isset($admin->settings['captcha_on'])&& $admin->settings['captcha_on']=='1' && !empty($admin->settings['captcha_private_key']) && !empty($admin->settings['captcha_public_key'])){
164 $captcha_privatekey = $admin->settings['captcha_private_key'];
165 $captcha_publickey = $admin->settings['captcha_public_key'];
166 $captcha_js .="<script type='text/javascript' src='" . getJSPath('cache/include/javascript/sugar_grp1_yui.js') . "'></script><script type='text/javascript' src='" . getJSPath('cache/include/javascript/sugar_grp_yui2.js') . "'></script>
167 <script type='text/javascript' src='http://api.recaptcha.net/js/recaptcha_ajax.js'></script>
169 function initCaptcha(){
170 Recaptcha.create('$captcha_publickey' ,'captchaImage',{theme:'custom'});
172 window.onload=initCaptcha;
174 var handleFailure=handleSuccess;
175 var handleSuccess = function(o){
176 if(o.responseText!==undefined && o.responseText =='Success'){
181 if(o.responseText!='')
182 document.getElementById('generate_success').innerHTML =o.responseText;
186 var callback2 ={ success:handleSuccess, failure: handleFailure };
188 function validateAndSubmit(){
189 var form = document.getElementById('form');
190 var url = '&to_pdf=1&module=Home&action=index&entryPoint=Changenewpassword&recaptcha_challenge_field='+Recaptcha.get_challenge()+'&recaptcha_response_field='+ Recaptcha.get_response();
191 YAHOO.util.Connect.asyncRequest('POST','index.php',callback2,url);
194 <td scope='row' width='20%'>".$mod_strings['LBL_RECAPTCHA_INSTRUCTION'].":</td>
195 <td width='70%'><input type='text' size='26' id='recaptcha_response_field' value=''></td>
200 <td colspan='2'><div style='margin-left:2px'class='x-sqs-list' id='recaptcha_image'></div></td>
203 <td colspan='2' align='right'><a href='javascript:Recaptcha.reload()'>".$mod_strings['LBL_RECAPTCHA_NEW_CAPTCHA']."</a>
204 <a class='recaptcha_only_if_image' href='javascript:Recaptcha.switch_type(\"audio\")'>".$mod_strings['LBL_RECAPTCHA_SOUND']."</a>
205 <a class='recaptcha_only_if_audio' href='javascript:Recaptcha.switch_type(\"image\")'> ".$mod_strings['LBL_RECAPTCHA_IMAGE']."</a>
208 $sugar_smarty->assign('CAPTCHA', $Captcha);
213 function validateAndSubmit(){generatepwd();}
217 $sugar_smarty->display('modules/Users/login.tpl'); ?>