Added account deletion and password recovery

This commit is contained in:
MatMasIt
2021-08-13 18:52:11 +02:00
committed by GitHub
parent a2b0e641f9
commit fd99756330
4 changed files with 135 additions and 17 deletions

16
lib.php
View File

@ -8,7 +8,7 @@ if (!function_exists('str_contains')) {
function pdomake()
{
return new PDO("sqlite:07abd9b090f514cbce89b2a932b2ec9f/db.db");
return new PDO("sqlite:07abd9b090f514cbce89b2a932b2ec9f/f.sqlite3");
}
$GLOBALS["classesWhitelist"] = [
"1A",
@ -629,7 +629,8 @@ function processDishes($data)
return true;
}
function newViewCheck($token,$view){
function newViewCheck($token,$view)
{
if(empty($token) || empty($view)) return "EMPTY";
$p = pdomake();
$q = $p->prepare("SELECT * FROM Users WHERE token=:token");
@ -646,3 +647,14 @@ function newViewCheck($token,$view){
]);
return true;
}
function deleteMe($token)
{
$u = use_token($token);
$p = pdomake();
if ($u == null || $u["isStaff"]) return false;
$q = $p->prepare("DELETE FROM Users WHERE token=:token");
$q->execute([
":token" => $token
]);
}