Beispiel #1
0
 /**
  * Do not override this function.
  *
  * @return Page
  */
 public function showLoginForm()
 {
     $this->app->template->trySet('page_title', 'Login');
     if ($this->app->layout && $this->login_layout_class) {
         $this->app->layout->destroy();
         $this->app->add($this->login_layout_class);
         /** @type Page $p */
         $p = $this->app->layout->add('Page', null, null, array('page/login'));
     } else {
         /** @type Page $p */
         $p = $this->app->add('Page', null, null, array('page/login'));
     }
     $this->app->page_object = $p;
     // hook: createForm use this to build basic login form
     $this->form = $this->hook('createForm', array($p));
     // If no hook, build standard form
     if (!is_object($this->form)) {
         $this->form = $this->createForm($p);
     }
     $this->hook('updateForm');
     $f = $this->form;
     if ($f->isSubmitted()) {
         $id = $this->verifyCredentials($f->get('username'), $f->get('password'));
         if ($id) {
             $this->loginByID($id);
             $this->loggedIn($f->get('username'), $f->get('password'));
             exit;
         }
         $f->getElement('password')->displayFieldError('Incorrect login information');
     }
     return $p;
 }
Beispiel #2
0
 /**
  * @todo Description
  *
  * @param Exception $e
  */
 public function caughtException($e)
 {
     if ($e instanceof Exception_Migration) {
         try {
             // The mesage is for user. Let's display it nicely.
             $this->app->pathfinder->addLocation(array('public' => '.'))->setCDN('http://www.agiletoolkit.org/');
             /** @type Layout_Basic $l */
             $l = $this->app->add('Layout_Basic', null, null, array('layout/installer'));
             /** @type View $i */
             $i = $l->add('View');
             $i->addClass('atk-align-center');
             /** @type H1 $h */
             $h = $i->add('H1');
             $h->set($e->getMessage());
             if ($e instanceof Exception_Migration) {
                 /** @type P $p */
                 $p = $i->add('P');
                 $p->set('Hello and welcome to Agile Toolkit 4.3. ' . 'Your project may require some minor tweaks before you can use 4.3.');
             }
             /** @type Button $b */
             $b = $i->add('Button');
             $b->addClass('atk-swatch-green')->set(array('Migration Guide', 'icon' => 'book'))->link('https://github.com/atk4/docs/blob/master/articles/migration42/index.md');
             if ($this->app->template && $this->app->template->hasTag('Layout')) {
                 $t = $this->app->template;
             } else {
                 /** @type GiTemplate $t */
                 $t = $this->add('GiTemplate');
                 $t->loadTemplate('html');
             }
             $t->setHTML('Layout', $l->getHTML());
             $t->trySet('css', 'http://css.agiletoolkit.org/framework/css/installer.css');
             echo $t->render();
             exit;
         } catch (BaseException $e) {
             echo 'here';
             $this->app->add('Logger');
             return parent::caughtException($e);
         }
     }
     return parent::caughtException($e);
 }