diff --git a/app/Controller/User.php b/app/Controller/User.php index 946373ef0..189d068d2 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -298,7 +298,7 @@ class User extends Base if ($this->request->isPost()) { - $values = $this->request->getValues() + array('disable_login_form' => 0); + $values = $this->request->getValues(); if ($this->userSession->isAdmin()) { $values += array('is_admin' => 0); @@ -334,6 +334,44 @@ class User extends Base ))); } + /** + * Display a form to edit authentication + * + * @access public + */ + public function authentication() + { + $user = $this->getUser(); + $values = $user; + $errors = array(); + + unset($values['password']); + + if ($this->request->isPost()) { + + $values = $this->request->getValues() + array('disable_login_form' => 0, 'is_ldap_user' => 0); + list($valid, $errors) = $this->user->validateModification($values); + + if ($valid) { + + if ($this->user->update($values)) { + $this->session->flash(t('User updated successfully.')); + } + else { + $this->session->flashError(t('Unable to update your user.')); + } + + $this->response->redirect($this->helper->url->to('user', 'authentication', array('user_id' => $user['id']))); + } + } + + $this->response->html($this->layout('user/authentication', array( + 'values' => $values, + 'errors' => $errors, + 'user' => $user, + ))); + } + /** * Remove a user * diff --git a/app/Model/Acl.php b/app/Model/Acl.php index dfdc82d28..b9c06e984 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -70,7 +70,7 @@ class Acl extends Base * @var array */ private $admin_acl = array( - 'user' => array('index', 'create', 'save', 'remove'), + 'user' => array('index', 'create', 'save', 'remove', 'authentication'), 'config' => '*', 'link' => '*', 'project' => array('remove'), diff --git a/app/Template/user/authentication.php b/app/Template/user/authentication.php new file mode 100644 index 000000000..a62c8f93e --- /dev/null +++ b/app/Template/user/authentication.php @@ -0,0 +1,32 @@ +