Added routes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once "../../../bootstrap.php";
|
||||
require "../../../bootstrap.php";
|
||||
|
||||
use Backend\Models\Group;
|
||||
use Backend\Models\Password;
|
||||
@@ -25,24 +25,26 @@ if(isset($_POST['login'])){
|
||||
$_SESSION['groupName'] = $groupName;
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
//header('location: ../../../Frontend/index.php?login=success');
|
||||
echo "YES";
|
||||
header('location: ../../../Frontend/index.php?login=success');
|
||||
exit();
|
||||
}
|
||||
else{
|
||||
session_destroy();
|
||||
header('location: ../../../Frontend/index.php?login=failed&?reason=token');
|
||||
exit();
|
||||
}
|
||||
|
||||
}else{
|
||||
session_destroy();
|
||||
header('location: ../../../Frontend/index.php?login=failed&?reason=password');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
session_destroy();
|
||||
header('location: ../../../Frontend/index.php?login=failed&?reason=group');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,11 +12,19 @@ if(isAdmin()){
|
||||
$password->password = password_hash($_POST['newPassword'], PASSWORD_DEFAULT);
|
||||
echo $password;
|
||||
if(!$password->save()){
|
||||
|
||||
header("location: ../../../Frontend/Html/AdminPage.html?error=FailedSaveResetPassword");
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
|
||||
header("location: ../../../Frontend/Html/AdminPage.html?success=SavedResetPassword");
|
||||
exit();
|
||||
}
|
||||
|
||||
}else{
|
||||
header("location: ../../../Frontend/Html/AdminPage.html?error=FailedToResetPassword");
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=NotAdmin");
|
||||
exit();
|
||||
}
|
||||
@@ -43,8 +43,13 @@ if(isset($_POST['regGroup'])){
|
||||
$_SESSION['groupName'] = $groupName;
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['success'] = "You are now logged in";
|
||||
header('location: ../../../Frontend/index.html');
|
||||
header("location: ../../../Frontend/index.html?success=GroupRegister");
|
||||
exit();
|
||||
}else{
|
||||
|
||||
header("location: ../../../Frontend/index.html?error=CouldNotValidatePassword");
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=FailedRegister");
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -11,8 +11,16 @@ if(isLogin()){
|
||||
$group->group_amount = $_POST['groupAmount'];
|
||||
$group->game_jam_id = $_POST['gameJamId'];
|
||||
$group->save();
|
||||
header("location: ../../../Frontend/index.html?success=YouHaveUpdated");
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=CouldNotUpdate");
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=NotLogin");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,11 +4,20 @@ require_once "Group.php";
|
||||
use Backend\Models\Password;
|
||||
|
||||
if(isLogin()){
|
||||
if(isset($_POST['updatePassword']))
|
||||
$password = Password::firstWhere("group_id", groupViaToken($_SESSION["token"])->id);
|
||||
if(passwordValidate($pass = $_POST['password'])){
|
||||
$password->password = password_hash($pass,PASSWORD_DEFAULT);
|
||||
$password->save();
|
||||
if(isset($_POST['updatePassword'])){
|
||||
$password = Password::firstWhere("group_id", groupViaToken($_SESSION["token"])->id);
|
||||
if(passwordValidate($pass = $_POST['password'])){
|
||||
$password->password = password_hash($pass,PASSWORD_DEFAULT);
|
||||
$password->save();
|
||||
header("location: ../../../Frontend/index.html?success=PasswordUpdated");
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=CouldNotUpdated");
|
||||
exit();
|
||||
}
|
||||
|
||||
}else{
|
||||
header("location: ../../../Frontend/index.html?error=NotLogin");
|
||||
exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user