public function renderConsumerScript()
 {
     wp_enqueue_script('jquery');
     // Consumer script
     echo parent::getConsumerScript();
 }
Esempio n. 2
0
    if (!empty($_POST['login']) and !empty($_POST['pass']) and $user = authenticate($_POST['login'], $_POST['pass'])) {
        // Authentication logic
        if (login_user($user)) {
            // Successful login
            hook_auth_success($user);
            redirect($config['websiteUrl'] . '?rublonLogin=success');
        } else {
            // invalid login credentials
            logout();
        }
    } else {
        // Login page
        show_messages();
        echo '<html><head><title>Rublon Example</title><link rel="stylesheet" href="./style.css" type="text/css" /></head><body>
			<form method=post><input name=login><input type=password name=pass><input type=submit>';
        $gui = new Rublon2FactorGUI($rublon, $userId = null, $userEmail = null, $logoutListener = false);
        echo $gui->getConsumerScript();
        // Rublon Subscribe Widget
        require_once '../libs/Rublon/core/HTML/RublonSubscribeWidget.php';
        echo '<div>' . new RublonSubscribeWidget() . '</div>';
        // Rublon Login Box
        require_once '../libs/Rublon/core/HTML/RublonLoginBox.php';
        echo '<div>' . new RublonLoginBox('./native-login.php') . '</div>';
        echo '</body></html>';
    }
} else {
    // User is logged in
    if (!empty($_GET['action']) and $_GET['action'] == 'logout') {
        // Logout action
        logout();
        redirect('index.php');