Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
c7f17a7c17
|
@ -1,7 +1,7 @@
|
|||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
# Group-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
require "../../../bootstrap.php";
|
||||
|
||||
use Backend\Models\AdminUser;
|
||||
|
||||
//Start the php session
|
||||
session_start();
|
||||
|
||||
if(isset($_POST['ALogin'])){
|
||||
|
||||
$userName = $_POST["userName"];
|
||||
$password = $_POST["password"];
|
||||
|
||||
$user = AdminUser::firstWhere('user_name', $userName );
|
||||
if($user){
|
||||
$hashedPassword = $user->password;
|
||||
if(password_verify($password, $hashedPassword )){
|
||||
$_SESSION['userName'] = $userName;
|
||||
$_SESSION['Admin'] = true;
|
||||
$_SESSION['userId'] = $user->id;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
header('location: ../Frontend/index.php?login=success');
|
||||
}else{
|
||||
session_destroy();
|
||||
header('location: ../Frontend/index.php?login=failed?reason=password');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
session_destroy();
|
||||
header('location: ../Frontend/index.php?login=failed?reason=username');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
require "../../../bootstrap.php";
|
||||
use Backend\Models\GameJam;
|
||||
|
||||
if(isset($_SESSION['Admin'])){
|
||||
if(isset($_POST['NewGameJam'])){
|
||||
$gameJam = New GameJam();
|
||||
|
||||
$gameJam->name = $_POST["gameJam_name"];
|
||||
$gameJam->start_time = $_POST["start_time"];
|
||||
$gameJam->end_time = $_POST["end_time"];
|
||||
$gameJam->description = $_POST["description"];
|
||||
|
||||
if($gameJam->save()){
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,10 @@ if(isset($_SESSION['Admin'])){
|
|||
if(isset($_POST['RestPassword'])){
|
||||
$group = Group::find($_POST['groupId']);
|
||||
if($group){
|
||||
$group->password->password = password_hash("Aa123456&", PASSWORD_DEFAULT);
|
||||
$group->password->password = password_hash($_POST['NewPassword'], PASSWORD_DEFAULT);
|
||||
if($group->save()){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
require "../../../bootstrap.php";
|
||||
use Backend\Models\GameJam;
|
||||
|
||||
if(isset($_SESSION['Admin'])){
|
||||
if(isset($_POST['UpdateGameJam'])) {
|
||||
$gameJam = GameJam::find($_POST['game_jam_id']);
|
||||
if($gameJam){
|
||||
|
||||
$gameJam->name = $_POST['name'];
|
||||
|
||||
$gameJam->start_time = $_POST['start_time'];
|
||||
|
||||
$gameJam->end_time = $_POST['start_time'];
|
||||
|
||||
if (!empty($_POST['key_word'])) {
|
||||
$gameJam->key_word = $_POST['key_word'];
|
||||
}
|
||||
|
||||
$gameJam->description = $_POST['description'];
|
||||
if ($gameJam->save()) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
require "../../../bootstrap.php";
|
||||
|
||||
use Backend\Models\Group;
|
||||
use Backend\Models\Password;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
//Start the php session
|
||||
session_start();
|
||||
|
||||
if(isset($_POST['login'])){
|
||||
|
||||
$groupName = $_POST["groupName"];
|
||||
$password = $_POST["password"];
|
||||
|
||||
$group = Group::firstWhere('group_name', $groupName );
|
||||
if($group){
|
||||
$hashedPassword = $group->password->password;
|
||||
if(password_verify($password, $hashedPassword )){
|
||||
$token = Str::random(100);
|
||||
$grouppassword = Password::firstWhere('group_id', $group->id);
|
||||
$grouppassword->remember_token = $token;
|
||||
if($grouppassword->save()){
|
||||
$_SESSION['groupName'] = $groupName;
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
header('location: ../../../Frontend/index.php?login=success');
|
||||
}
|
||||
else{
|
||||
session_destroy();
|
||||
header('location: ../../../Frontend/index.php?login=failed&?reason=token');
|
||||
}
|
||||
|
||||
}else{
|
||||
session_destroy();
|
||||
header('location: ../../../Frontend/index.php?login=failed&?reason=password');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
session_destroy();
|
||||
header('location: ../../../Frontend/index.php?login=failed&?reason=group');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ require "../../../bootstrap.php";
|
|||
use Backend\Models\Group;
|
||||
use Backend\Models\Password;
|
||||
use Backend\Models\GameJam;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
session_start();
|
||||
|
||||
|
@ -33,12 +34,16 @@ if(isset($_POST['reg_group'])){
|
|||
|
||||
$password->password = password_hash($_POST['password'] ,PASSWORD_DEFAULT);
|
||||
|
||||
$token = Str::random(100);
|
||||
|
||||
$password->remember_token = $token;
|
||||
|
||||
if(!$password->save()){
|
||||
return;
|
||||
}
|
||||
|
||||
$_SESSION['groupName'] = $groupName;
|
||||
$_SESSION['groupId'] = $group->id;
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
header('location: index.php');
|
||||
header('location: ../../../Frontend/index.php');
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
require "../../../bootstrap.php";
|
||||
|
||||
use Backend\Models\Group;
|
||||
|
||||
session_start();
|
||||
if (isset($_POST['updateGroup'])) {
|
||||
if($group = Group::find($_POST['groupId'])){
|
||||
if ($group->password->remember_token === $_SESSION['token']){
|
||||
$group->group_name = $_POST['group_name'];
|
||||
$group->group_amount = $_POST['group_amount'];
|
||||
$group->game_jam_id = $_POST['game_jam_id'];
|
||||
$group->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?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::firstWhere('group_name', $groupName );
|
||||
if($group){
|
||||
$hashedPassword = $group->password->password;
|
||||
if(password_verify($password, $hashedPassword )){
|
||||
$_SESSION['groupName'] = $groupName;
|
||||
$_SESSION['groupId'] = $group->id;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
header('location: ../Frontend/index.php?login=success');
|
||||
}else{
|
||||
session_destroy();
|
||||
header('location: ../Frontend/index.php?login=failed?reason=password');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
session_destroy();
|
||||
header('location: ../Frontend/index.php?login=failed?reason=group');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"require": {
|
||||
"illuminate/database": "^8.30"
|
||||
"illuminate/database": "^8.30",
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
|
|
@ -438,16 +438,16 @@
|
|||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "2.45.1",
|
||||
"version": "2.46.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||
"reference": "528783b188bdb853eb21239b1722831e0f000a8d"
|
||||
"reference": "2fd2c4a77d58a4e95234c8a61c5df1f157a91bf4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/528783b188bdb853eb21239b1722831e0f000a8d",
|
||||
"reference": "528783b188bdb853eb21239b1722831e0f000a8d",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/2fd2c4a77d58a4e95234c8a61c5df1f157a91bf4",
|
||||
"reference": "2fd2c4a77d58a4e95234c8a61c5df1f157a91bf4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -527,7 +527,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-02-11T18:30:17+00:00"
|
||||
"time": "2021-02-24T17:30:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
|
|
Loading…
Reference in New Issue