Add edit form for user authentication

This commit is contained in:
Frederic Guillot
2015-07-16 21:33:05 -04:00
parent b0ac201340
commit e0d4877126
5 changed files with 78 additions and 10 deletions

View File

@@ -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
*