minor changes:

- when admin adds a user, auth key is automatically suggested
- auth refresh is performed after user edition
pull/61/head
Andrzej Dereszowski 2012-04-02 23:00:41 +02:00
parent 69fef3f6fa
commit 9e04311622
2 changed files with 7 additions and 1 deletions

View File

@ -87,6 +87,7 @@ class UsersController extends AppController {
// Save the data
if ($this->User->save($this->request->data, true ,$fieldList)) {
$this->Session->setFlash(__('The profile has been updated'));
$this->_refreshAuth();
$this->redirect(array('action' => 'view', $id));
} else {
$this->Session->setFlash(__('The profile could not be updated. Please, try again.'));
@ -165,6 +166,10 @@ class UsersController extends AppController {
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
} else {
// generate auth key for a new user
$newkey = $this->User->generateAuthKey();
$this->set('authkey', $newkey);
}
}
@ -188,6 +193,7 @@ class UsersController extends AppController {
$fields[] = 'password';
if ($this->User->save($this->request->data, true, $fields)) {
$this->Session->setFlash(__('The user has been saved'));
$this->_refreshAuth(); // in case we modify ourselves
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));

View File

@ -8,7 +8,7 @@
echo $this->Form->input('confirm_password', array('type' => 'password', 'div' => array('class' => 'input password required')));
echo $this->Form->input('org');
echo $this->Form->input('autoalert');
echo $this->Form->input('authkey');
echo $this->Form->input('authkey', array('value' => $authkey));
echo $this->Form->input('nids_sid');
echo $this->Form->input('termsaccepted');
echo $this->Form->input('newsread');