summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-16 21:33:05 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-16 21:33:05 -0400
commite0d4877126acc1e7189e6e67e1f1ca24e1dd5f02 (patch)
treee8c4b318c0c29bd2bdc8cd27a6a2803ca845ac8f /app/Controller
parentb0ac2013402001408a9cf35a7fa6c91bf224d287 (diff)
Add edit form for user authentication
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/User.php40
1 files changed, 39 insertions, 1 deletions
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 946373ef..189d068d 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);
@@ -335,6 +335,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
*
* @access public