<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * 登录
 * @author yzxh24
 */
class LoginAction extends BaseAction
{
    public function run()
    {
        $form = new AdminLoginForm();
        if (isset($_POST['AdminLoginForm']))
        {
            $form->attributes = $_POST['AdminLoginForm'];
            if ($form->validate())
            {
                $redirect = empty($_GET['redirect']) ? array('/admin/default/index') : trim($_GET['redirect']);
                $this->getController()->redirect($redirect);
            }
        }

        $this->getController()->layout = false;
        $this->getController()->render('login', array('form'=>$form));
    }
}