* @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3 * @package SWDB */ require_once(PATH::PAGE . "Page.php"); /** * Login page model. * * @category Page */ class Login_Page extends Page{ /** * @var bool Indicates if the user has been redirected to this page after an error. */ private $is_error = false; /** * @var string Error message to show when login was unsuccesfull and * the user is back in the login page */ private $error_message = ""; /** * Constructor. * * Retrieves the data and initializes the variables. */ public function __construct(){ parent::__construct(); $this->set_public(true); $this->set_view("login.php"); $this->set_title("Login"); $this->set_description("Login to SWDB"); $this->set_canonical("login/"); $this->add_css("login.css"); error_log("STATUS: " . filter_input(INPUT_GET, "status")); if (http_response_code() == 401 || filter_input(INPUT_GET, "status") == "401"){ error_log("LOGIN ERROR"); $this->is_error = true; $this->error_message = "Invalid credentials"; $this->set_message("Invalid credentials"); } else{ $this->set_code(200); $this->set_message("OK"); } } /** * Checks if a error has redirected the user to shis page. * * @return bool True if there was an error, false otherwise */ public function is_error(){ return $this->is_error; } /** * Retrieves the error message to show. * * @return string Error message. */ public function get_error_message(){ return $this->error_message; } }