Major refactor of the console screen, game code rewritten in Typescript, users can now change their passwords

This commit is contained in:
simon
2018-01-17 19:30:27 -05:00
parent 9903631a93
commit 5d36a55f2d
66 changed files with 2745 additions and 48058 deletions

39
changePassword.re.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
include_once "include/UserManager.php";
include_once "include/MessageCookie.php";
include_once "include/SessionManager.php";
$user = SessionManager::get();
if ($user != NULL) {
$password = $_POST['password'];
$newPassword = $_POST['new_password'];
if (strlen($newPassword) < 8 || strlen($newPassword) > 96) {
(new MessageCookie("Password must be 8-96 characters", "register"))->setCookie();
header("Location: account.php");
} else {
if (UserManager::auth($user['username'], $password) != NULL) {
UserManager::changePassword($user['username'], $newPassword);
header("Location: index.php");
} else {
$msg = new MessageCookie("Invalid password", "register");
$msg->setCookie();
header("Location: account.php");
}
}
} else {
$msg = new MessageCookie("You must be logged in to do that", "register");
$msg->setCookie();
header("Location: account.php");
}