Merge branch 'main' of https://gitea.itskp-odense.dk/Game-jam-Devs/Game-Jaming
This commit is contained in:
commit
4db2b3d3a3
|
@ -18,7 +18,7 @@ if (isset($_POST['aLogin'])) {
|
|||
if (password_verify($password, $hashedPassword)) {
|
||||
$_SESSION['userName'] = $userName;
|
||||
$_SESSION['admin'] = true;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
//$_SESSION['success'] = "You are now logged in";
|
||||
http_response_code(200);
|
||||
makeAdminLogin($userName);
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,8 @@ if (isAdmin()) {
|
|||
if (isset($_POST["newAdmin"])) {
|
||||
$admin = new AdminUser();
|
||||
$admin->user_name = $_POST["newUsername"];
|
||||
$admin->password = $_POST["newPassword"];
|
||||
$admin->password = password_hash($_POST["newPassword"],PASSWORD_DEFAULT);
|
||||
|
||||
if ($admin->save()) {
|
||||
http_response_code(201);
|
||||
} else {
|
||||
|
|
|
@ -23,7 +23,7 @@ if (isAdmin()) {
|
|||
|
||||
$gameJam->description = $_POST['description'];
|
||||
if ($gameJam->save()) {
|
||||
http_response_code(201);
|
||||
http_response_code(200);
|
||||
} else {
|
||||
http_response_code(500);
|
||||
}
|
||||
|
|
|
@ -15,4 +15,6 @@ if (isset($_GET["groupId"])) {
|
|||
header("Access-Control-Allow-Methods: GET");
|
||||
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
|
||||
header('Content-Type: application/json;charset=UTF-8');
|
||||
echo json_encode(array('data' => $groups->jsonSerialize()));
|
||||
echo json_encode(array('data' => $groups->jsonSerialize()));
|
||||
|
||||
|
||||
|
|
|
@ -10,11 +10,10 @@ if (isAdmin()) {
|
|||
$password = Password::firstWhere("group_id", $_POST['groupId']);
|
||||
if ($password) {
|
||||
$password->password = password_hash($_POST['newPassword'], PASSWORD_DEFAULT);
|
||||
echo $password;
|
||||
if (!$password->save()) {
|
||||
http_response_code(500);
|
||||
} else {
|
||||
http_response_code(201);
|
||||
http_response_code(200);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400);
|
||||
|
|
|
@ -8,9 +8,6 @@ use Backend\Models\Password;
|
|||
use Backend\Models\GameJam;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
$groupName = "";
|
||||
$errors = array();
|
||||
|
||||
if (isset($_POST['regGroup'])) {
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (isLogin()) {
|
|||
if (!$group->save()) {
|
||||
http_response_code(500);
|
||||
} else {
|
||||
http_response_code(201);
|
||||
http_response_code(200);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400);
|
||||
|
|
|
@ -12,7 +12,7 @@ if (isLogin()) {
|
|||
if (!$password->save()) {
|
||||
http_response_code(500);
|
||||
} else {
|
||||
http_response_code(201);
|
||||
http_response_code(200);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400);
|
||||
|
|
|
@ -1 +1,20 @@
|
|||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
|
||||
use Backend\Models\Registration;
|
||||
|
||||
if(isset($_GET["registrationId"])){
|
||||
$regs = Registration::find($_GET["registrationId"]);
|
||||
} elseif (isset($_GET["groupId"])){
|
||||
$regs = Registration::where("group_id", $_GET["groupId"])->get();
|
||||
} elseif (isset($_GET["gameJamId"])){
|
||||
$regs = Registration::where("game_jam_id", $_GET["gameJamId"])->get();
|
||||
}elseif (isset($_GET["gameDataId"])){
|
||||
$regs = Registration::where("game_data_id", $_GET["gameDataId"])->get();
|
||||
}else{
|
||||
$regs = Registration::all();
|
||||
}
|
||||
header("Access-Control-Allow-Methods: GET");
|
||||
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
|
||||
header('Content-Type: application/json;charset=UTF-8');
|
||||
echo json_encode(array('data' => $regs->jsonSerialize()));
|
|
@ -6,7 +6,7 @@ use Backend\Models\Registration;
|
|||
|
||||
if(isLogin()){
|
||||
if(isset($_POST['updateReg'])){
|
||||
if($reg = Registration::where("group_id", $_POST["groupId"])->where("game_jam_id", $_POST["gameJamId"])->first()){
|
||||
if($reg = Registration::find($_POST["registrationId"])->where("group_id", groupViaToken($_SESSION['token'])->id)->first()){
|
||||
$reg->group_amount = $_POST["groupAmount"];
|
||||
if($reg->save()){
|
||||
http_response_code(200);
|
||||
|
|
Loading…
Reference in New Issue