Permalink
Browse files

More TODOs. Made deleting self less of a jarring error. Made redirect

now die after header is sent.
  • Loading branch information...
1 parent 03394fe commit 68bcba3ee345eb9e723a5dac4a752db0adfc90f2 @robertabramski committed Feb 4, 2012
Showing with 11 additions and 2 deletions.
  1. +1 −0 system/application/models/users.php
  2. +9 −1 system/core/admin.php
  3. +1 −1 system/core/pep.php
  4. BIN system/database/pep.db
@@ -7,6 +7,7 @@ public function __construct()
parent::__construct();
//TODO: User uniqueness.
+ //TODO: Need some description options to display in admin.
$this->fields = array
(
'user_id' => array('type' => 'pk', 'name' => 'Key'),
View
@@ -162,13 +162,17 @@ public function update($name = '', $id = '')
if($opts['type'] == 'password')
{
+ //Store clear pass in case of authed user.
$pass = $post[$key];
+
+ // Remove if password is blank or hash it.
if(empty($post[$key])) unset($post[$key]);
else $post[$key] = md5($post[$key]);
}
if($opts['type'] == 'checkbox')
{
+ //TODO: Turn checkboxes into tinyint value.
$post[$key] = ($post[$key] == 'on' ? 'on' : 'off');
}
}
@@ -258,7 +262,11 @@ public function delete($name = '', $id = '')
if(empty($name) || empty($id)) show_error();
// You cannot delete yourself.
- if($this->auth->authed_user('user_id') == $id) show_error('You cannot delete yourself.');
+ if($this->auth->authed_user('user_id') == $id)
+ {
+ $this->session->set('result', 'You cannot delete yourself.');
+ redirect('admin');
+ }
$model = $this->load->model($name);
$fields = $model->fields;
View
@@ -141,7 +141,7 @@ public function partial($name)
*/
public static function redirect($loc)
{
- header('Location: ' . rtrim(self::get_setting('base_url'), '/') . '/' . $loc);
+ die(header('Location: ' . rtrim(self::get_setting('base_url'), '/') . '/' . $loc));
}
/**
View
Binary file not shown.

0 comments on commit 68bcba3

Please sign in to comment.