blob: 7502b03bd222925815e9b6d6046f54ff7caa3698 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
namespace Controller;
use Database;
use Exception;
function on_post() {
global $user_status;
global $token;
$user_status = "";
try {
$user = Database\User::fromDB($_POST["username"]);
if (password_verify($_POST["password"], $user->Password)) {
$token = Database\Cookie::create($user->UID);
}
else {
$user_status = "Incorrect password!";
}
}
catch(Exception $e) {
$user_status = "User \"" . $_POST["username"] . "\" doesn't exist!";
}
}
|