public function index() { if (Session::loggedIn()) { $this->template("header", ["title" => App::NAME, "subtitle" => App::TAGLINE, "categories" => ArticleCategory::getObjsAll()]); // $this->template("hero", ["title" => "News"]); $this->view("account/index", ["user" => User::getObjByEmail(Session::getUsername())]); //$this->jq("account/index"); $this->template("footer"); } else { header("Location: /"); } }
public function login() { $user = User::getObjByEmail($_POST["email"]); if (isset($user) && password_verify($_POST["password"], $user->getPassword())) { Session::setUsername($user->getEmail()); $user->setAuthKey(String::generateRandomString()); $user->save(); if (isset($_POST['remember-me'])) { Session::setRememberMeFlag(); Cookie::setRememberMeCookies($user->getEmail(), $user->getAuthKey()); } header("Location: /"); } else { header("Location: /auth"); } }