diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-12-06 12:33:28 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-12-06 12:33:28 -0500 |
commit | 52c1a3b374d6c34abd9016a102bb73dc5cce895e (patch) | |
tree | 175bee40503470890b5f71beb4b1c6a7e064596c | |
parent | c79fad62f740593ed9d4a6220975b8a20db384a1 (diff) |
Remove some code duplication
-rw-r--r-- | app/Controller/User.php | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/app/Controller/User.php b/app/Controller/User.php index 31413fc0..93b5ca18 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -28,15 +28,15 @@ class User extends Base * * @access public */ - public function login() + public function login(array $values = array(), array $errors = array()) { if ($this->acl->isLogged()) { $this->response->redirect('?controller=app'); } $this->response->html($this->template->layout('user/login', array( - 'errors' => array(), - 'values' => array(), + 'errors' => $errors, + 'values' => $values, 'no_layout' => true, 'redirect_query' => $this->request->getStringParam('redirect_query'), 'title' => t('Login') @@ -63,13 +63,7 @@ class User extends Base } } - $this->response->html($this->template->layout('user/login', array( - 'errors' => $errors, - 'values' => $values, - 'no_layout' => true, - 'redirect_query' => $redirect_query, - 'title' => t('Login') - ))); + $this->login($values, $errors); } /** @@ -154,13 +148,13 @@ class User extends Base * * @access public */ - public function create() + public function create(array $values = array(), array $errors = array()) { $this->response->html($this->template->layout('user/new', array( 'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()), 'projects' => $this->project->getList(), - 'errors' => array(), - 'values' => array(), + 'errors' => $errors, + 'values' => $values, 'title' => t('New user') ))); } @@ -186,13 +180,7 @@ class User extends Base } } - $this->response->html($this->template->layout('user/new', array( - 'board_selector' => $this->projectPermission->getAllowedProjects($this->acl->getUserId()), - 'projects' => $this->project->getList(), - 'errors' => $errors, - 'values' => $values, - 'title' => t('New user') - ))); + $this->create($values, $errors); } /** |