layout; routing; login
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
//require __DIR__ . '/classes/JwtHandler.php';
|
||||
require __DIR__ . '/classes/lib.php';
|
||||
|
||||
//class Auth extends JwtHandler
|
||||
class Auth
|
||||
@ -53,26 +54,17 @@ class Auth
|
||||
isset($data['data']->id) &&
|
||||
$user = $this->fetchUser($data['data']->id)
|
||||
) :
|
||||
return [
|
||||
"success" => 1,
|
||||
"message" => "User found",
|
||||
"user" => $user
|
||||
];
|
||||
$retVal = new CMsg(1, 200, "User found", null, $user);
|
||||
return $retVal->jsonarray();
|
||||
else :
|
||||
return [
|
||||
"success" => 0,
|
||||
"message" => $data['message'],
|
||||
"user" => null
|
||||
];
|
||||
$retVal = new CMsg(0, 422, $data['message'], null, null);
|
||||
return $retVal->jsonarray();
|
||||
endif;
|
||||
}
|
||||
else
|
||||
{
|
||||
return [
|
||||
"success" => 0,
|
||||
"message" => "User not found in request",
|
||||
"user" => null
|
||||
];
|
||||
$retVal = new CMsg(0, 422, "User not found in request", null, null);
|
||||
return $retVal->jsonarray();
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,10 +78,9 @@ class Auth
|
||||
|
||||
if ($query_stmt->rowCount()) :
|
||||
$returnVal = $query_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$returnVal->session = $_SESSION;
|
||||
return $returnVal;
|
||||
else :
|
||||
return false;
|
||||
return null;
|
||||
endif;
|
||||
} catch (PDOException $e) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user