Made login
This commit is contained in:
parent
c3479e8e7b
commit
9a38284c8b
|
@ -10,10 +10,10 @@ Capsule::schema()->create("groups", function (Blueprint $table){
|
|||
$table->id();
|
||||
$table->string("groupName");
|
||||
$table->integer("groupAmount");
|
||||
$table->foreignId("fkGameJam")->constrained("game_jams");
|
||||
$table->foreignId("game_jam_id")->constrained("game_jams");
|
||||
$table->integer("votes")->nullable();
|
||||
$table->foreignId("fkPassword")->constrained("password");
|
||||
$table->foreignId("fkGameData")->nullable()->constrained("game_data");
|
||||
$table->foreignId("password_id")->constrained("passwords");
|
||||
$table->foreignId("game_data_id")->nullable()->constrained("game_data");
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Schema;
|
|||
Capsule::schema()->create("key_words", function (Blueprint $table){
|
||||
$table->id();
|
||||
$table->string('keyWord');
|
||||
$table->foreignId("fkGroup")->constrained("groups");
|
||||
$table->foreignId("group_id")->constrained("groups");
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use Illuminate\Database\Schema\Blueprint;
|
|||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
//Create password table with the rows as id, password, rememberToken and timestamps
|
||||
Capsule::schema()->create("password", function (Blueprint $table){
|
||||
Capsule::schema()->create("passwords", function (Blueprint $table){
|
||||
$table->id();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
|
|
|
@ -1 +1,27 @@
|
|||
<?php
|
||||
|
||||
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"];
|
||||
|
||||
$group = Group::where('groupName', $groupName )->first();
|
||||
if($group){
|
||||
$hashedPassword = $group->password()->id;
|
||||
if(password_verify($password, $hashedPassword )){
|
||||
$_SESSION['groupName'] = $groupName;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
header('location: Main.php?yeah=aa');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
|
||||
|
||||
use Backend\Models\GameJam;
|
||||
|
||||
|
||||
|
@ -11,3 +9,30 @@ $gameJam = GameJam::firstOrCreate([
|
|||
'name' => "First game jam ever!", 'startTime' => "2021-03-03T12:40", 'endTime' => "2021-04-03T12:40", 'description' => "Det her et en beskrivelse"
|
||||
]);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<title>HTML Tutorial</title>
|
||||
<body>
|
||||
|
||||
<form action="SigningUp.php" method="POST">
|
||||
<input type="text" name="groupName" placeholder="Group name">
|
||||
<input type="number" name="groupAmount" placeholder="Group Amount">
|
||||
<input type="number" name="gameJamId" placeholder="Game Jam id">
|
||||
<input type="password" name="password" placeholder="password">
|
||||
<input type="submit" name="reg_group" value="Register">
|
||||
</form>
|
||||
|
||||
|
||||
<form action="Login.php" method="POST">
|
||||
<input type="text" name="groupName" placeholder="Group name">
|
||||
<input type="password" name="password" placeholder="password">
|
||||
<input type="submit" name="login" value="login">
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require "../bootstrap.php";
|
||||
|
||||
use Backend\Models\Group;
|
||||
use Backend\Models\Password;
|
||||
use Backend\Models\GameJam;
|
||||
|
@ -12,7 +14,7 @@ $errors = array();
|
|||
if(isset($_POST['reg_group'])){
|
||||
|
||||
|
||||
$password = New Password;
|
||||
$password = New Password();
|
||||
|
||||
$password->password = password_hash($_POST['password'] ,PASSWORD_DEFAULT);
|
||||
|
||||
|
|
Loading…
Reference in New Issue