folder restrokteer

This commit is contained in:
RundelhausCode 2021-03-09 10:45:05 +01:00
parent 66eefe37a5
commit fbdf9e675c
11 changed files with 113 additions and 5 deletions

2
.gitignore vendored
View File

@ -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

View File

@ -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');
}
}

View File

@ -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{
}
}
}

View File

@ -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()){
}
}
}
}

View File

@ -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()) {
}
}
}
}

View File

@ -0,0 +1 @@
<?php

View File

@ -33,12 +33,16 @@ if(isset($_POST['reg_group'])){
$password->password = password_hash($_POST['password'] ,PASSWORD_DEFAULT);
$token = OAuthProvider::generateToken(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');
}

View File

@ -0,0 +1,15 @@
<?php
require "../../../bootstrap.php";
use Backend\Models\Group;
use Backend\Models\Password;
session_start();
if(isset($_SESSION['groupId'])){
if (isset($_POST['updateGroup'])) {
$_POST['updateGroup']
}
}

View File

@ -1,6 +1,7 @@
{
"require": {
"illuminate/database": "^8.30"
"illuminate/database": "^8.30",
"ext-oauth": "*"
},
"autoload": {
"classmap": [