Skip to content
Snippets Groups Projects
Authentication.php 1.24 KiB
Newer Older
<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Authentication extends Controller {
        
        public function before() {
            parent::before();
            if(UTF8::strcasecmp($this->request->action(), 'logout'))
            {
                if(Auth::isLoggedIn())
                {
                    $account = Auth::getData();
                    $page = Request::factory($account['Type'].'/index')->execute();
                    $this->response->body($page);
                }
            }
        }
    
        public function action_sign()
        {
            if(!Auth::isLoggedIn())
            {
                $type = $this->request->param('type');
                if(empty($type)) $type = 'in';
                $twig = Twig::factory('sign/'.$type);
                $this->response->body($twig);
            }
        }
        
        public function action_remind()
        {
            if(!Auth::isLoggedIn())
            {
                $twig = Twig::factory('sign/remindpass');
                $this->response->body($twig);
            }
        }
        
        public function action_logout()
        {
            Auth::logout();
            $this->action_sign();
        }

} // End Welcome