iwa-panda1

Manage Weather Data by International Weather Agency (Version 1)
Log | Files | Refs

commit d43d5457dfa908bf43a07221bad488d8bd989202
parent d3c5de2ec9fcf0b3e3a5f822088ab4d0a4c5cf21
Author: MoiBaguette <[email protected]>
Date:   Thu, 20 Apr 2023 00:31:25 +0200

if left an error msg in

Diffstat:
Mclasses/Login_handler.php | 2+-
Mlogic/login.php | 9++-------
2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/classes/Login_handler.php b/classes/Login_handler.php @@ -12,7 +12,7 @@ class Login_handler //check if the email exists in db if(!$u->where('email', $email)){ //email does not exist - return FILTER_SANITIZE_ADD_SLASHES; + return false; }else{ if(password_verify($pwd, $u->password)){ //authenticated -> set $_SESSION variables diff --git a/logic/login.php b/logic/login.php @@ -5,18 +5,13 @@ include "utils\autoloader.php"; $login_handler = new Login_handler; $msg = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { - if(!isset($_POST['email']) || !isset($_POST['password'])){ - $msg = "<p style=\"color:red\">One of the forms was empty.</p>"; - } elseif(isset($_POST['email']) && isset($_POST['password'])) { + if(isset($_POST['email']) || !isset($_POST['password'])){ // fetch data from the form pass to login_handler function if(($login_handler->login($_POST['email'], $_POST['password']))){ //authenticated - $msg = "authenticated"; header('Location: /dashboard'); - }else{ - //incorrect username or password - $msg = "<p style=\"color:red\">Incorrect username of password 2.</p>"; } } + $msg = "<p style=\"color:red\">Incorrect username of password.</p>"; } ?> \ No newline at end of file