public function loginAction() { if ($this->request->isPost()) { $data = $this->request->getPost(); $user = Users::findByEmail($data['email']); if ($user and $this->security->checkHash($data['password'], $user->password)) { $this->flash->success('欢迎' . $user->name . '登录!你上次登录的时间是:' . $user->updated_at); EventFacade::fire('auth:login', $user, $data); $this->redirectByRoute(['for' => 'home']); } else { $this->flash->error('登录不成功,密码或者邮件地址有误!'); } } if ($this->session->has('auth')) { $this->redirectByRoute(['for' => 'home']); } $this->view->form = myForm::buildLoginForm(); }