| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- /**
- * Landing (login) page file.
- *
- * Provides a class with all the properties and methods to display the page.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @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;
- }
-
- }
|