public function mainAction() { if (Admin_View_Helper_Authentication::isUserAdmin()) { $form = new Admin_Form_ChangePasswordForm(); if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $data = $this->_user->changePassword($formData); if ($data['status'] == 0) { $this->view->error = $data['message']; } else { $this->view->message = $data['message']; } } else { $form->populate($formData); } } $this->view->form = $form; } else { $form = new Admin_Form_LoginForm(); if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $data = $this->_user->login($formData); if ($data['status'] == 0) { $this->view->error = "Login failed"; } else { $this->redirect("enlighten/panel/main/"); } } else { $form->populate($formData); } } $this->view->form = $form; } }