getLoginURL() public method

Retrieve a URL that can be used to log the user in.
public getLoginURL ( string | null $returnTo = null ) : string
$returnTo string | null The page the user should be returned to afterwards. If this parameter is null, the user will be returned to the current page.
return string A URL which is suitable for use in link-elements.
Example #1
0
 public function __construct()
 {
     //	Obligatoire
     parent::__construct();
     $this->data = array();
     // System FED Oxylane
     if (FEDACTIVE) {
         require __DIR__ . '/../simplesaml/lib/_autoload.php';
         $as = new SimpleSAML_Auth_Simple('Oxylane-sp');
         $isAuth = $as->isAuthenticated();
         $url = $as->getLoginURL();
         if (!$isAuth) {
             //$url = $as->getLoginURL();
             //echo '<p>You are not authenticated. <a href="' . htmlspecialchars($url) . '">Log in</a>.</p>';
             $as->requireAuth();
         } else {
             //$url = $as->getLogoutURL();
             //echo '<p>You are currently authenticated. <a href="' . htmlspecialchars($url) . '">Log out</a>.</p>';
             $attributes = $as->getAttributes();
             $uid = $attributes['uid'][0];
             $this->data['fed']['0'] = $uid;
             $this->data['fed']['1'] = $attributes['cn'][0];
             $this->data['fed']['2'] = $attributes['mail'][0];
             $this->load->model('admins_model', 'am');
             $admins = $this->am->getAll();
             if (!$this->in_array_column($uid, $admins)) {
                 echo "Utilisateur non autoris&eacute;s";
                 redirect('welcome', 'refresh');
             }
         }
     } else {
         $this->data['fed']['0'] = "ID";
         $this->data['fed']['1'] = "NOM";
         $this->data['fed']['2'] = "MAIL";
     }
     // END System FED Oxylane
     //	Chargement des ressources pour tout le contrôleur
     $this->load->database();
     $this->load->helper('form');
     $this->load->library('form_validation');
     $this->load->model('pages_model', 'pm');
     $this->load->model('chaines_model', 'cm');
     $this->load->model('groupes_model', 'gm');
     $this->load->model('logs_model', 'lm');
 }
Example #2
0
function openBuilding(x) {
    window.open('/building.php?latlng='+x, 'Building', 'width=780, height=580, resizable=yes, scrollbars=yes, location=no')};
</script>
<?php 
global $CONNECT, $RESULT, $DBDATABASE, $DBUSER, $DBPASSWORD;
require_once "/var/www/simplesamlphp/lib/_autoload.php";
$auth = new SimpleSAML_Auth_Simple("osm");
$DBHOST = "localhost";
$DBDATABASE = "pedro";
$DBUSER = "******";
$DBPASSWORD = "******";
$CONNECT = pg_connect("host={$DBHOST} dbname={$DBDATABASE} password={$DBPASSWORD} user={$DBUSER}") or die("Databaze je down.");
$set = pg_query($CONNECT, "set client_encoding to UNICODE;");
$logged = false;
if (!$auth->isAuthenticated()) {
    echo "Uživatel nepřihlášen - <a href=\"" . $auth->getLoginURL() . "\">přihlásit</a>";
}
if ($auth->isAuthenticated()) {
    $attr = $auth->getAttributes();
    $user_id = '';
    $user_nick = '';
    $osm_user = '';
    if (isset($attr["id"])) {
        $user_id = $attr["id"][0];
    }
    if (isset($attr["nick"])) {
        $user_nick = $attr["nick"][0];
    }
    if (isset($attr["osm_user"])) {
        $logged = true;
    }