/**
     * Reads the input parameters and sets up the login action.
     *
     * @param array $p_input
     */
    public function __construct(array $p_input)
    {
        $this->m_defined = true;
        $this->m_name = 'login';
        if (!isset($p_input['f_login_uname']) || empty($p_input['f_login_uname'])) {
            $this->m_error = new PEAR_Error('The user name was not filled in.',
            ACTION_LOGIN_ERR_NO_USER_NAME);
            return;
        }
        $this->m_properties['user_name'] = $p_input['f_login_uname'];
        if (!isset($p_input['f_login_password'])) {
            $this->m_error = new PEAR_Error('The password was not filled in.',
            ACTION_LOGIN_ERR_NO_PASSWORD);
            return;
        }
        global $LiveUser;
        if (!$LiveUser->login($p_input['f_login_uname'], $p_input['f_login_password'], false)) {
            $this->m_error = new PEAR_Error('Invalid user credentials',
            ACTION_LOGIN_ERR_INVALID_CREDENTIALS);
            return;
        }
        $this->m_properties['remember_user'] = isset($p_input['f_login_rememberuser'])
        && !empty($p_input['f_login_rememberuser']);

        $this->m_error = ACTION_OK;
        $this->m_user = User::FetchUserByName($this->m_properties['user_name']);;
        $this->m_user->initLoginKey();
    }
Beispiel #2
0
    } elseif (!$LiveUser->login($f_user_name, $t_password, false)) {
    	camp_html_goto_page("/$ADMIN/login.php", TRUE, array(
            'error_code' => 'userpass',
            'request' => $requestId,
        ));
    }
}

if ($LiveUser->getProperty('reader') == 'Y') {
    camp_html_goto_page("/$ADMIN/login.php", TRUE, array(
        'error_code' => 'userpass',
        'request' => $requestId,
    ));
}

$user = User::FetchUserByName($f_user_name, true);
$validateCaptcha = LoginAttempts::MaxLoginAttemptsExceeded();

//
// Valid login section
//
if ($LiveUser->isLoggedIn()) {
    if (is_null($user)) {
        // load data to User from liveuser_users
        // and create the user object
    }
    if (!$validateCaptcha || PhpCaptcha::Validate($f_captcha_code, true)) {
        // if user valid, password valid, encrypted, no CAPTCHA -> login
        // if user valid, password valid, encrypted, CAPTCHA valid -> login
        camp_successful_login($user, $f_login_language);
    }