Compare commits
2 Commits
379634db47
...
619a052309
Author | SHA1 | Date |
---|---|---|
Jonas | 619a052309 | |
Jonas | 5213c33f2a |
|
@ -18,7 +18,7 @@ if (isset($_POST['aLogin'])) {
|
||||||
if (password_verify($password, $hashedPassword)) {
|
if (password_verify($password, $hashedPassword)) {
|
||||||
$_SESSION['userName'] = $userName;
|
$_SESSION['userName'] = $userName;
|
||||||
$_SESSION['admin'] = true;
|
$_SESSION['admin'] = true;
|
||||||
$_SESSION['success'] = "You are now logged in";
|
//$_SESSION['success'] = "You are now logged in";
|
||||||
http_response_code(200);
|
http_response_code(200);
|
||||||
makeAdminLogin($userName);
|
makeAdminLogin($userName);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,7 +8,8 @@ if (isAdmin()) {
|
||||||
if (isset($_POST["newAdmin"])) {
|
if (isset($_POST["newAdmin"])) {
|
||||||
$admin = new AdminUser();
|
$admin = new AdminUser();
|
||||||
$admin->user_name = $_POST["newUsername"];
|
$admin->user_name = $_POST["newUsername"];
|
||||||
$admin->password = $_POST["newPassword"];
|
$admin->password = password_hash($_POST["newPassword"],PASSWORD_DEFAULT);
|
||||||
|
|
||||||
if ($admin->save()) {
|
if ($admin->save()) {
|
||||||
http_response_code(201);
|
http_response_code(201);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -23,7 +23,7 @@ if (isAdmin()) {
|
||||||
|
|
||||||
$gameJam->description = $_POST['description'];
|
$gameJam->description = $_POST['description'];
|
||||||
if ($gameJam->save()) {
|
if ($gameJam->save()) {
|
||||||
http_response_code(201);
|
http_response_code(200);
|
||||||
} else {
|
} else {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,3 +16,5 @@ header("Access-Control-Allow-Methods: GET");
|
||||||
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
|
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
|
||||||
header('Content-Type: application/json;charset=UTF-8');
|
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']);
|
$password = Password::firstWhere("group_id", $_POST['groupId']);
|
||||||
if ($password) {
|
if ($password) {
|
||||||
$password->password = password_hash($_POST['newPassword'], PASSWORD_DEFAULT);
|
$password->password = password_hash($_POST['newPassword'], PASSWORD_DEFAULT);
|
||||||
echo $password;
|
|
||||||
if (!$password->save()) {
|
if (!$password->save()) {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
} else {
|
} else {
|
||||||
http_response_code(201);
|
http_response_code(200);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
|
|
|
@ -8,9 +8,6 @@ use Backend\Models\Password;
|
||||||
use Backend\Models\GameJam;
|
use Backend\Models\GameJam;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
$groupName = "";
|
|
||||||
$errors = array();
|
|
||||||
|
|
||||||
if (isset($_POST['regGroup'])) {
|
if (isset($_POST['regGroup'])) {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (isLogin()) {
|
||||||
if (!$group->save()) {
|
if (!$group->save()) {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
} else {
|
} else {
|
||||||
http_response_code(201);
|
http_response_code(200);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
|
|
|
@ -12,7 +12,7 @@ if (isLogin()) {
|
||||||
if (!$password->save()) {
|
if (!$password->save()) {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
} else {
|
} else {
|
||||||
http_response_code(201);
|
http_response_code(200);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
|
|
|
@ -1 +1,20 @@
|
||||||
<?php
|
<?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(isLogin()){
|
||||||
if(isset($_POST['updateReg'])){
|
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"];
|
$reg->group_amount = $_POST["groupAmount"];
|
||||||
if($reg->save()){
|
if($reg->save()){
|
||||||
http_response_code(200);
|
http_response_code(200);
|
||||||
|
|
Loading…
Reference in New Issue