-
Notifications
You must be signed in to change notification settings - Fork 0
/
loginPOST.php
33 lines (23 loc) · 722 Bytes
/
loginPOST.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
//requirement files
require './Bootstrap.php';
//usages package
use app\Data\Repository\UserRepository;
use app\Helpers\UserData;
use app\Helpers\ManageSession;
//get variables from input
$AllDataFromForm = $_REQUEST;
$email = UserData::requestData("email");
$password = $_REQUEST['password'];
// validate the variable from input
UserData::requirement($AllDataFromForm,"/loginGET.php");
// find user by email
$user =new UserRepository();
// validate password
$result = $user->findByEmail($email);
$HashPassword = $result['password'];
$isLogin = UserRepository::loginAccess($password,$HashPassword);
if ($isLogin) {
ManageSession::loginUserSession($result);
header("Location: /dashboard.php");
}