SAND-framework/application/include/controlleurs/logout.php
Emmanuel ROY 1baeaa7f03 Test sur l'implémentation de hybridAuth -> ne recoit pas les données utilisateur mais par contre se connecte
TODO: créé les pages de blog (sommaire,news) permettant d'afficher les fichiers md
TODO: créer les commandes complétement
TODO: envoyer les bugs wordpress
TODO: corriger le bug de création de la base de donnée pour prestashop
2020-03-19 16:57:14 +01:00

48 lines
1.2 KiB
PHP

<?php
use MVC\Classe\Dumper;
require CONFIG_PATH . DIRECTORY_SEPARATOR . "authentification-config-example.php";
try {
\MVC\Classe\Session::start();
$hybridauth = new Hybridauth\Hybridauth($config);
$storage = new Hybridauth\Storage\Session();
$error = false;
//
// Event 2: User clicked LOGOUT link
//
if (isset($url_params['logout'])) {
if (in_array($url_params['logout'], $hybridauth->getProviders())) {
// Disconnect the adapter
$adapter = $hybridauth->getAdapter($url_params['logout']);
$adapter->disconnect();
header("location: ".MVC\Classe\Url::link_rewrite(false,'accueil'));
} else {
$error = $url_params['logout'];
}
}
//
// Handle invalid provider errors
//
if ($error !== false) {
error_log('HybridAuth Error: Provider ' . json_encode($error) . ' not found or not enabled in $config');
// Close the pop-up window
echo "
<script>
window.opener.location.reload();
window.close();
</script>";
exit;
}
} catch (Exception $e) {
error_log($e->getMessage());
echo $e->getMessage();
}