2021-03-04 08:18:32 +00:00
|
|
|
<?php
|
2021-03-04 12:13:07 +00:00
|
|
|
|
|
|
|
require "../bootstrap.php";
|
|
|
|
|
|
|
|
use Backend\Models\Group;
|
|
|
|
use Backend\Models\Password;
|
|
|
|
|
|
|
|
//Start the php session
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
if(isset($_POST['login'])){
|
|
|
|
|
|
|
|
$groupName = $_POST["groupName"];
|
|
|
|
$password = $_POST["password"];
|
|
|
|
|
2021-03-04 12:31:11 +00:00
|
|
|
$group = Group::firstWhere('groupName', $groupName );
|
2021-03-04 12:13:07 +00:00
|
|
|
if($group){
|
2021-03-04 13:12:14 +00:00
|
|
|
$hashedPassword = $group->password->password;
|
2021-03-04 12:13:07 +00:00
|
|
|
if(password_verify($password, $hashedPassword )){
|
|
|
|
$_SESSION['groupName'] = $groupName;
|
|
|
|
$_SESSION['success'] = "You are now logged in";
|
2021-03-05 09:52:42 +00:00
|
|
|
header('location: ../Frontend/group.php?login=success');
|
2021-03-04 12:13:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|