Création de l'authentification (en cours)

This commit is contained in:
xdrm-brackets 2015-10-20 23:03:24 +02:00
parent e9a025a5e0
commit 153e4f23a5
3 changed files with 28 additions and 8 deletions

View File

@ -125,8 +125,15 @@ body{
/*display: block;*/ display: none;
position: fixed;
top: 30%;
left: calc( 50% - 500px/2 );
width: 500px;
left: calc( 50% - 250px/2 );
width: 250px;
/* foreground */
color: #fff;
font-weight: bold;
text-transform: uppercase;
line-height: 3em;
text-shadow: 1px 1px 0 #666;
/* z axis */
z-index: 101;
@ -140,8 +147,8 @@ body{
display: block;
position: relative;
top: 0;
left: 25%;
width: calc( 50% - 2*.8em );
left: 0;
width: calc( 100% - 2*.8em );
margin-bottom: 2em;
padding: .8em;
@ -169,7 +176,7 @@ body{
/* SUBMIT */
#AUTH input[type=submit]{
/* position */
width: 50%;
width: 100%;
/* foreground */
color: #fff;

View File

@ -1,6 +1,12 @@
<?php
<?php session_start();
$postAreSet = isset($_POST['username']) && isset($_POST['password']); // variables POST existent
$postStrings = $postAreSet && is_string($_POST['username']) && is_string($_POST['password']); // sont toutes 2 des strings
$postNotEmpty = $postStrings && strlen($_POST['username']) > 1 && strlen($_POST['password']) > 1; // d'au moins 2 caractères
if( $postNotEmpty ){
$userlist = file_get_contents('src/userlist.json');
}
// $_SERVER['HTTP_USER_AGENT']; // dépends du navigateur (version, système X, OS)
// $_SERVER['REMOTE_ADDR']; // ip publique de l'utilisateur
@ -51,13 +57,19 @@
<a href='settings.php'>Paramètres </a>
</nav>
<a>Authentification</a>
<?php
if( isset($_SESSION['username']) && strlen($_SESSION['username']) > 1 )
echo '<a>'.$_SESSION['username'].'</a>';
else
echo "<a class='active'>Authentificaiton</a>";
?>
</div>
<div id='AUTH_FILTER'></div>
<form id='AUTH' action='' method='POST'>
Connection
<input type='text' name='username' placeholder='username'>
<input type='password' name='password' placeholder='password'>
<input type='submit' value='Connection'>

View File

@ -11,7 +11,8 @@ var DOM = {
/* GESTION DE L'AFFICHAGE DU LOGIN */
DOM.authBtn.addEventListener('click', function(e){ // clic sur "Authentification"
e.preventDefault(); // désactive l'action par défaut
DOM.loginFltr.className = 'active';
if( e.target.className == 'active' )
DOM.loginFltr.className = 'active';
}, false);
/* GESTION DE CACHAGE DU LOGIN */