#1 2014-07-25 03:42:19

jeonyi
Member
Registered: 2013-03-28
Posts: 10

[1.0.7 Bug] Can't add a new user.

I tried to add a new user in the 1.0.7 version. But I fail to add it.

Offline

#2 2014-07-28 12:12:32

jeonyi
Member
Registered: 2013-03-28
Posts: 10

Re: [1.0.7 Bug] Can't add a new user.

I solved this problem.

application/controllers/admin/user.php

            // Existing
            if ($id_user != FALSE)
            {
                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']);
                }
            }
            // New
            else
            {
                $post['password'] = User()->encrypt($this->input->post('password'), $post);
//New line ----------------------------------  210 line
                $post['id_user'] = null;  // to avoid primary key id_user, when save function insert $post

            }

Offline

#3 2014-10-21 22:02:24

irata
Member
From: Bergisch Gladbach, Germany
Registered: 2013-12-06
Posts: 6
Website

Re: [1.0.7 Bug] Can't add a new user.

First of all, the old code (and the patch one post above) does not compare password and password2 for new users, only for existing ones (and the comparison can be shortened according to the rules of logic). Second, $post['id_user'] has to be set to null for new users.

So here is my fix to this problem. Replace the following lines in application/controllers/admin/user.php beginning at line 194:

// Existing
if ($id_user != FALSE)
{
	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']);
	}
}
// New
else
{
	$post['password'] = User()->encrypt($this->input->post('password'), $post);
}

with the following:

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

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

Last edited by irata (2014-10-21 22:15:19)

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations