Example #1
0
/**
 * API method
 * Performs a login
 * @param mixed[] $params
 *    @option string username
 *    @option string password
 */
function ws_session_login($params, &$service)
{
    if (try_log_user($params['username'], $params['password'], false)) {
        return true;
    }
    return new PwgError(999, 'Invalid username/password');
}
Example #2
0
if (!empty($_GET['redirect'])) {
    $redirect_to = urldecode($_GET['redirect']);
    if (is_a_guest()) {
        $page['errors'][] = l10n('You are not authorized to access the requested page');
    }
}
if (isset($_POST['login'])) {
    if (!isset($_COOKIE[session_name()])) {
        $page['errors'][] = l10n('Cookies are blocked or not supported by your browser. You must enable cookies to connect.');
    } else {
        if ($conf['insensitive_case_logon'] == true) {
            $_POST['username'] = search_case_username($_POST['username']);
        }
        $redirect_to = isset($_POST['redirect']) ? urldecode($_POST['redirect']) : '';
        $remember_me = isset($_POST['remember_me']) and $_POST['remember_me'] == 1;
        if (try_log_user($_POST['username'], $_POST['password'], $remember_me)) {
            redirect(empty($redirect_to) ? get_gallery_home_url() : $redirect_to);
        } else {
            $page['errors'][] = l10n('Invalid password!');
        }
    }
}
//----------------------------------------------------- template initialization
//
// Start output of page
//
$title = l10n('Identification');
$page['body_id'] = 'theIdentificationPage';
$template->set_filenames(array('identification' => 'identification.tpl'));
$template->assign(array('U_REDIRECT' => $redirect_to, 'F_LOGIN_ACTION' => get_root_url() . 'identification.php', 'authorize_remembering' => $conf['authorize_remembering']));
if (!$conf['gallery_locked'] && $conf['allow_user_registration']) {