From f3b3ea69fb46e45bf3598aa7a6bcf62aa80e4703 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 4 Sep 2011 21:09:57 -0400 Subject: mv src/controllers/Auth{,Page}.class.php, change a few things (I'm terrible) --- src/controllers/Auth.class.php | 57 -------------------------------------- src/controllers/AuthPage.class.php | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 57 deletions(-) delete mode 100644 src/controllers/Auth.class.php create mode 100644 src/controllers/AuthPage.class.php (limited to 'src/controllers') diff --git a/src/controllers/Auth.class.php b/src/controllers/Auth.class.php deleted file mode 100644 index 86bd83f..0000000 --- a/src/controllers/Auth.class.php +++ /dev/null @@ -1,57 +0,0 @@ -login(); break; - case 'logout': $this->logout(); break; - case '' : $this->maybe_login(); break; - default : $this->badrequest(); break; - } - } - private function login() { - $username = ''; - $password = ''; - - $login = -1; - if ( isset($_POST['username']) && isset($_POST['password'])) { - $username = $_POST['username']; - $password = $_POST['password']; - $login = $mm->login($username, $password); - } - - $vars = array(); - $vars['login_code'] = $login; - $vars['username'] = $username; - $vars['password'] = $password; - if (isset($_POST['url'])) { - $vars['url'] = $_POST['url']; - } - - $this->showView('auth/login', $vars); - } - private function logout() { - global $mm; - $mm->logout(); - $this->showView('auth/logout'); - } - private function maybe_login() { - global $mm; - $uid = $mm->isLoggedIn(); - if ($uid===false) { - $this->login(); - } else { - $username = $mm->getUsername($uid); - $this->showView('auth/index', - array('username'=>$username)); - } - } - private function badrequest() { - $this->showView('auth/badrequest'); - } -} diff --git a/src/controllers/AuthPage.class.php b/src/controllers/AuthPage.class.php new file mode 100644 index 0000000..127bc1f --- /dev/null +++ b/src/controllers/AuthPage.class.php @@ -0,0 +1,56 @@ +login(); break; + case 'logout': $this->logout(); break; + case '' : $this->maybe_login(); break; + default : $this->badrequest(); break; + } + } + private function login() { + $username = ''; + $password = ''; + + $login = -1; + if ( isset($_POST['username']) && isset($_POST['password'])) { + $username = $_POST['username']; + $password = $_POST['password']; + $login = Login::login($username, $password); + } + + $vars = array(); + $vars['login_code'] = $login; + $vars['username'] = $username; + $vars['password'] = $password; + if (isset($_POST['url'])) { + $vars['url'] = $_POST['url']; + } + + $this->showView('auth/login', $vars); + } + private function logout() { + Login::logout(); + $this->showView('auth/logout'); + } + private function maybe_login() { + global $mm; + $uid = Login::isLoggedIn(); + if ($uid===false) { + $this->login(); + } else { + $username = $mm->database()->getUsername($uid); + $this->showView('auth/index', + array('username'=>$username)); + } + } + private function badrequest() { + $this->showView('auth/badrequest'); + } +} -- cgit v1.2.3-2-g168b