Sign in
validate_username($_POST['user_name']);
$password = $form->validate_password($_POST['user_pass']);
$form->on_success(function () use ($username, $password) {
$user = new User();
$user->get_by_name($username);
if (!$user->has_value()) {
trigger_error('There is no user with that name. Did you mean to create a new account?');
} else {
if (!password_verify($password, $user->password)) {
echo 'Password does not match!';
} else {
Session::get()->sign_in($user);
header("Location: /");
}
}
});
}
?>