Skip to content

Commit

Permalink
commentaires
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinheiro9 committed Jun 19, 2020
1 parent 4798c69 commit cbfe81e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/controler/loginControler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@
// This funtion will try to Login Using the provided data
function login($infoLogin, $password)
{
// TODO: Code the Login function
// If trying to login it checks the data, else load the page
if ($infoLogin != "") {
if (strlen($infoLogin) == 3) {//If the infoLogin is initials, then convert it to upper case
if (strlen($infoLogin) == 3) {// If the infoLogin is initials, then convert it to upper case
$infoLogin = strtoupper($infoLogin);
}
$UserLog = getUser($infoLogin);
if (password_verify($password, $UserLog['password'])) {
unset($UserLog['password']); //unset password to not save it in the session
$_SESSION['user'] = $UserLog; //save all informations of the users in the session
displaydebug($_SESSION);
unset($UserLog['password']); // Unset password to not save it in the session
$_SESSION['user'] = $UserLog; // Save all informations of the users in the session
displaydebug($_SESSION); // Function that will display a var_dump if the debug mode is active
require_once 'view/home.php';
} else {
$_SESSION['error'] = 1;
Expand All @@ -32,10 +31,10 @@ function login($infoLogin, $password)
}
}

// function to logout the user from de current session
// Function to logout the user from de current session
function logout()
{
unset($_SESSION['user']);
unset($_SESSION['user']); // Clears the session
login(null, null);
}

Expand Down

0 comments on commit cbfe81e

Please sign in to comment.