authenticator() static public method

static public authenticator ( $context = 'gb-admin' )
Esempio n. 1
0
    gb::event('client-authorized', $authed);
    $url = isset($_REQUEST['referrer']) && $_REQUEST['referrer'] ? $_REQUEST['referrer'] : gb_admin::$url;
    header('HTTP/1.1 303 See Other');
    header('Location: ' . $url);
    exit('<html><body>See Other <a href="' . $url . '"></a></body></html>');
}
if (isset($_POST['chap-username'])) {
    if ($authed === CHAP::BAD_USER) {
        gb::$errors[] = 'No such user';
    } elseif ($authed === CHAP::BAD_RESPONSE) {
        gb::$errors[] = 'Bad password';
    } else {
        gb::$errors[] = 'Unknown error';
    }
}
$auth = gb::authenticator();
include '../_header.php';
?>
<script type="text/javascript" src="<?php 
echo gb_admin::$url;
?>
res/sha1-min.js"></script>
<script type="text/javascript">
	//<![CDATA[
	var chap = {
		submit: function(nonce, opaque, context) {
			if (typeof context == 'undefined')
				context = '';
			var username = $('#chap-username').get(0);
			var password = $('#chap-password').get(0);
			var shadow = hex_sha1(username.value+':'+context+':'+password.value);