Summary Files Commits Branches @commit @diff @stats
path: root / src / controllers / DashboardLoginController.php
blob: c6ac070aaf7ea2dc632c30032a17c3663cde0bb8 (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
24
25
26
27
28
<?php
include_once('controllers/BaseController.php');
include_once('controllers/DashboardController.php');

class DashboardLoginController extends BaseController {
	private static $message;

	public static function get() {
		include('views/dashboard-login.php');
	}

	public static function post() {
		// The dashboard(controller) doesn't have it's own URI (and all requests are sent in this controller), so
		// we can't send a request directly to dashboard.
		// This does compromise security, but for now it will have to do.
		if (isset($_POST['_method'])) {
			DashboardController::invoke();
		}
		else if ($_POST['username'] == 'admin' && $_POST['password'] == 'admin') {
			// Load normal dashboard
			DashboardController::get();
		}
		else {
			self::$message = 'Bad credentials!';
			include('views/dashboard-login.php');
		}
	}
}