Example #1
0
 public function load_user($id)
 {
     $user = new User();
     $user->retrieve($id);
     $result = $user->load_user("test");
     $this->assertEquals(true, $result->authenticated);
 }
Example #2
0
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
global $mod_strings;
$focus = new User();
// Add in defensive code here.
$focus->user_name = $_REQUEST['user_name'];
$user_password = $_REQUEST['user_password'];
$focus->load_user($user_password);
if ($focus->is_authenticated()) {
    // save the user information into the session
    // go to the home screen
    header("Location: " . $GLOBALS['app']->getLoginRedirect());
    unset($_SESSION['login_password']);
    unset($_SESSION['login_error']);
    unset($_SESSION['login_user_name']);
    $_SESSION['authenticated_user_id'] = $focus->id;
    // store the user's theme in the session
    if (isset($_REQUEST['login_theme'])) {
        $authenticated_user_theme = $_REQUEST['login_theme'];
    } elseif (isset($_REQUEST['ck_login_theme_20'])) {
        $authenticated_user_theme = $_REQUEST['ck_login_theme_20'];
    } else {
        $authenticated_user_theme = $sugar_config['default_theme'];
Example #3
0
 ********************************************************************************/
require_once 'modules/Leads/LeadFormBase.php';
global $app_strings, $app_list_strings;
$mod_strings = return_module_language($sugar_config['default_language'], 'Leads');
$app_list_strings['record_type_module'] = array('Contact' => 'Contacts', 'Account' => 'Accounts', 'Opportunity' => 'Opportunities', 'Case' => 'Cases', 'Note' => 'Notes', 'Call' => 'Calls', 'Email' => 'Emails', 'Meeting' => 'Meetings', 'Task' => 'Tasks', 'Lead' => 'Leads', 'Bug' => 'Bugs');
/**
 * To make your changes upgrade safe create a file called leadCapture_override.php and place the changes there
 */
$users = array('PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name' => 'PUT THE USER_NAME HERE', 'pass' => 'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'));
if (file_exists('leadCapture_override.php')) {
    include 'leadCapture_override.php';
}
if (!empty($_POST['user']) && !empty($users[$_POST['user']])) {
    $current_user = new User();
    $current_user->user_name = $users[$_POST['user']]['name'];
    if ($current_user->load_user($users[$_POST['user']]['pass'], true)) {
        $leadForm = new LeadFormBase();
        $prefix = '';
        if (!empty($_POST['prefix'])) {
            $prefix = $_POST['prefix'];
        }
        if (!isset($_POST['assigned_user_id']) || !empty($_POST['assigned_user_id'])) {
            $_POST['prefix'] = $current_user->id;
        }
        $_POST['record'] = '';
        if (isset($_POST['_splitName'])) {
            $name = explode(' ', $_POST['name']);
            if (sizeof($name) == 1) {
                $_POST['first_name'] = '';
                $_POST['last_name'] = $name[0];
            } else {