Reputation: 498
I'm running a update_user form through
$user = ORM::factory('user', $id)->update_user($this->request->post(), array(
'username',
'password',
'email'
));
And pre-populating the form fields username and email with the current user, and leaving the password blank in-order to be 'unchanged'
But on submission its picking up all the validation messages from create_user from the 'user' model
So i'm getting:
"username already taken"
"email address already taken"
"password can't be blank"
Does anyone know how your suppose to get round this?
Upvotes: 1
Views: 1262
Reputation: 1329
$user = $this->get_user();
if ( ! $user->loaded())
{
throw new Exception_Deny;
}
if ($_POST)
{
try
{
$user->update_user($_POST, array(
'username',
'email',
'password',
));
}
catch (ORM_Validation_Exception $e)
{
$this->add_errors($e);
}
}
$this->content = View::factory('user/update');
works absolutely properly - gives an error only when Im trying to assign existent another user's username or password... Check anything you've overrided in ORM or Model_User classes.
Upvotes: 3