Bug fixes in the admin view

- password changing for other users
- corrected admin_view
pull/61/head
Andrzej Dereszowski 2012-04-02 17:21:17 +02:00
parent 6c5a5aa427
commit 0374c1c9b6
2 changed files with 18 additions and 13 deletions

View File

@ -180,14 +180,24 @@ class UsersController extends AppController {
throw new NotFoundException(__('Invalid user'));
}
if ($this->request->is('post') || $this->request->is('put')) {
if ($this->User->save($this->request->data)) {
$fields = array();
foreach (array_keys($this->request->data['User']) as $field) {
if($field != 'password') array_push($fields, $field);
}
if ("" != $this->request->data['User']['password'])
$fields[] = 'password';
if ($this->User->save($this->request->data, true, $fields)) {
$this->Session->setFlash(__('The user has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
} else {
$this->request->data = $this->User->read(null, $id);
$this->User->recursive=0;
$this->User->read(null, $id);
$this->User->set('password', '');
$this->request->data = $this->User->data;
}
}

View File

@ -40,10 +40,12 @@
 
</dd>
<dt><?php echo __('Gpgkey'); ?></dt>
<dd>
<?php echo h($user['User']['gpgkey']); ?>
&nbsp;
</dd>
<dd style="font-size: 10px; line-height:100%;">
<code><?php echo nl2br(h($user['User']['gpgkey'])); ?></code>
&nbsp;
</dd>
<dt><?php echo __('Nids Sid'); ?></dt>
<dd>
<?php echo h($user['User']['nids_sid']); ?>
@ -109,11 +111,4 @@
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('User.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('User.id'))); ?></li>
<li>&nbsp;</li>
<?php echo $this->element('actions_menu'); ?>
</ul>
</div>
</div>