Petit plugin qui permet de deconnecter un utilisateur au bout d'un certain temps.

Ce temps est configurable dans le parametrage du plugin.
Au login d'un auteur, on stocke en session cette valeur. cela permettra d'ajouter un temps personnalisé pour chaque auteur (évolution).
svn/root/tags/v1.0.0
tofulm@gmail.com 5 years ago
parent cd8248fcc7
commit b2fb4b1e86

11
.gitattributes vendored

@ -1 +1,12 @@
* text=auto !eol
/decoauto_autorisations.php -text
/decoauto_pipelines.php -text
formulaires/configurer_decoauto.html -text
js/decoauto_deconnecter.js.html -text
lang/decoauto_fr.php -text
lang/paquet-decoauto_fr.php -text
/paquet.xml -text
prive/squelettes/contenu/configurer_decoauto.html -text
prive/themes/spip/images/decoauto-128.png -text svneol=unset#image/png
prive/themes/spip/images/decoauto-32.png -text svneol=unset#image/png
prive/themes/spip/images/decoauto-64.png -text svneol=unset#image/png

@ -0,0 +1,21 @@
<?php
/**
* Définit les autorisations du plugin Déconnexion Automatique
*
* @plugin Déconnexion Automatique
* @copyright 2019
* @author tofulm
* @licence GNU/GPL
* @package SPIP\Decoauto\Autorisations
*/
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
/**
* Fonction d'appel pour le pipeline
* @pipeline autoriser */
function decoauto_autoriser() {
}

@ -0,0 +1,29 @@
<?php
/**
* Utilisations de pipelines par Déconnexion Automatique
*
* @plugin Déconnexion Automatique
* @copyright 2019
* @author tofulm
* @licence GNU/GPL
* @package SPIP\Decoauto\Pipelines
*/
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
function decoauto_jquery_plugins($scripts){
$scripts[] = produire_fond_statique('js/decoauto_deconnecter.js');
return $scripts;
}
function decoauto_formulaire_traiter($flux){
if ($flux['args']['form'] === 'login') {
$tps_deconnexion = intval(lire_config('decoauto/tps_deconnexion'));
if ($tps_deconnexion) {
session_set('tps_deconnexion', $tps_deconnexion);
}
}
return $flux;
}

@ -0,0 +1,28 @@
<div class="formulaire_spip formulaire_configurer formulaire_#FORM">
<h3 class="titrem"><:decoauto:cfg_titre_parametrages:></h3>
[<p class="reponse_formulaire reponse_formulaire_ok">(#ENV*{message_ok})</p>]
[<p class="reponse_formulaire reponse_formulaire_erreur">(#ENV*{message_erreur})</p>]
<form method="post" action="#ENV{action}">
<div>
#ACTION_FORMULAIRE{#ENV{action}}
<div class="editer_groupe">
#SET{name,tps_deconnexion}
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
#SET{obli,"obligatoire"}
<div class="editer_[(#GET{name})][ (#GET{obli})][ (#GET{erreurs}|oui)erreur]">
<label for="#GET{name}">Temps avant déconnexion en secondes</label>
[<span class="erreur_message">(#GET{erreurs})</span>]
<input type="text" class="text tps_deconnexion" name="#GET{name}" id="#GET{name}" value="#ENV{#GET{name}}" >
</div>
</div>
<input type="hidden" name="_meta_casier" value="decoauto" />
<p class="boutons"><span class="image_loading">&nbsp;</span><input type="submit" class="submit" value="<:bouton_enregistrer:>" /></p>
</div>
</form>
</div>

@ -0,0 +1,31 @@
#HTTP_HEADER{Content-Type: text/javascript; charset=utf-8}
#HTTP_HEADER{Vary: Accept-Encoding}
[(#REM)<script>]
function deconnecte_session() {
window.location.href = "#URL_LOGOUT";
}
jQuery(function() {
var tps_deconnexion = "#SESSION{tps_deconnexion}";
if (tps_deconnexion) {
tps_deconnexion = parseInt(tps_deconnexion) * 1000;
} else {
tps_deconnexion = 0;
}
var compteur = setTimeout(deconnecte_session, tps_deconnexion);
$(document).on('click',function() {
clearTimeout(compteur);
compteur = setTimeout(deconnecte_session, tps_deconnexion);
});
$(document).on('keydown',function() {
clearTimeout(compteur);
compteur = setTimeout(deconnecte_session, tps_deconnexion);
});
});

@ -0,0 +1,20 @@
<?php
// This is a SPIP language file -- Ceci est un fichier langue de SPIP
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
$GLOBALS[$GLOBALS['idx_lang']] = array(
// D
'decoauto_titre' => 'Déconnexion Automatique',
// C
'cfg_exemple' => 'Exemple',
'cfg_exemple_explication' => 'Explication de cet exemple',
'cfg_titre_parametrages' => 'Paramétrages',
// T
'titre_page_configurer_decoauto' => 'Déconnexion Automatique',
);

@ -0,0 +1,14 @@
<?php
// This is a SPIP language file -- Ceci est un fichier langue de SPIP
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
$GLOBALS[$GLOBALS['idx_lang']] = array(
// D
'decoauto_description' => '',
'decoauto_nom' => 'Déconnexion Automatique',
'decoauto_slogan' => '',
);

@ -0,0 +1,22 @@
<paquet
prefix="decoauto"
categorie="auteur"
version="1.0.0"
etat="dev"
compatibilite="[3.2.3;3.2.*]"
logo="prive/themes/spip/images/decoauto-64.png"
documentation=""
>
<nom>Déconnexion Automatique</nom>
<auteur lien='http://gamuza.fr'>tofulm</auteur>
<licence>GNU/GPL</licence>
<pipeline nom="autoriser" inclure="decoauto_autorisations.php" />
<pipeline nom="jquery_plugins" inclure="decoauto_pipelines.php" />
<pipeline nom="formulaire_traiter" inclure="decoauto_pipelines.php" />
</paquet>

@ -0,0 +1,7 @@
[(#AUTORISER{configurer,_decoauto}|sinon_interdire_acces)]
<h1 class="grostitre"><:decoauto:titre_page_configurer_decoauto:></h1>
<div class="ajax">
#FORMULAIRE_CONFIGURER_DECOAUTO
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Loading…
Cancel
Save