Alternatively, you could do something a little simpler like:
Code:
$userModel = model('UserModel');
$user = user();
$user->password = $this->request->getPost('password');
$userModel->save($user);
This grabs the currently logged in user via the
user() helper function and returns a User entity. The
setPassword() method is called automatically by the Entity class when you assign the password to the user entity, so simply assigning it like that will automatically hash the password. Then the User entity is saved.