Skip to content

Commit

Permalink
Corrected password validation and creation of new user
Browse files Browse the repository at this point in the history
  • Loading branch information
rompcik committed Oct 21, 2014
1 parent 9005b0c commit bbceac7
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions application/controllers/admin/user.php
Expand Up @@ -191,23 +191,21 @@ public function save()
)
);

// Existing
if ($id_user != FALSE)
// Passwords must match
if (($this->input->post('password') != '') &&
($this->input->post('password') == $this->input->post('password2')))
{
if (($this->input->post('password') != '' && $this->input->post('password2') != '') &&
($this->input->post('password') == $this->input->post('password2')) )
{
$post['password'] = User()->encrypt($this->input->post('password'), $post);
}
else
{
unset($post['password'], $post['password2']);
}
$post['password'] = User()->encrypt($this->input->post('password'), $post);
}
// New
else
{
$post['password'] = User()->encrypt($this->input->post('password'), $post);
unset($post['password'], $post['password2']);
}

// New user?
if ($id_user == false)
{
$post['id_user'] = null;
}

// Save
Expand Down

0 comments on commit bbceac7

Please sign in to comment.