Base table or view not found. SQLSTATE[42S02]

Good morning, i was trying to test about login with datatable but, there’s that error, i don’t have the table users, just “persona” as “users” being a table “persona”.
As u see with images, that will explain a bit.


I’ll add later some of the appcontroller and table persona (i need to figure out where or how to insert the codes of php in this post)
I’m sure i did follow correctly the instructions on the cookbook about Authentication in CMS Tutorial and i needed to put the page login and redirect into the page of index.
Any help is welcome!

Specifically what version of CakePHP are you using, and what authentication method (the component or the plugin)?

Current cakephp 3.7.8 or 3.7.7 if i remember, i’ve did investigate for hours and i don’t really know how to fix that login problem, i don’t know how to derive it well to the correct database

I think that whether you’re using the component or the plugin, the default table to use is users, and you have to add a line to the configuration to tell it to use a different table. Without knowing which of the two methods you’re using, I can’t point you to the appropriate documentation, but I do know that it’s definitely documented in the book.

Okay, update, im bit frustrated with the error, there’s the code what im trying to working with the login (im trying to test without password hashing)

AppController.php

class AppController extends Controller
{

/**
 * Initialization hook method.
 *
 * Use this method to add common initialization code like loading components.
 *
 * e.g. `$this->loadComponent('Security');`
 *
 * @return void
 */
public function initialize()
{
    parent::initialize();

    $this->loadComponent('RequestHandler', [
        'enableBeforeRedirect' => false,
    ]);
    $this->loadComponent('Flash');
    //$this->loadComponent('Auth', [
    //    'authenticate' => [
    //        'Form' => [
    //            'fields' => ['nombre' => 'nombre', 'contrasena' => 'contrasena']
    //        ]
    //    ],
    //    'loginAction' => [
    //        'controller' => 'persona',
    //        'action' => 'login'
    //    ],
    //    'authError' => 'Credenciales inválidos',
    //    'loginRedirect' => '/persona/login',
    //    'storage' => 'Session'
    //]);

    /*
     * Enable the following component for recommended CakePHP security settings.
     * see https://book.cakephp.org/3.0/en/controllers/components/security.html
     */
    //$this->loadComponent('Security');
}

}

Entity of Persona

protected $_accessible = [
‘rut’ => true,
‘nombre’ => true,
‘apellido’ => true,
‘direccion’ => true,
‘telefono’ => true,
‘contrasena’ => true,
‘tipo_usuario_id’ => true,
‘tipo_usuario’ => true
];

protected $_hidden = [
    'contrasena'
];

//protected function _setPassword($contrasena) {
//    if(strlen($contrasena) > 0) {
//        return (new DefaultPasswordHasher) -> hash($contrasena);
//   }
//}

PersonaController.php

public function login() {
if ($this->request->is(‘post’)) {
$persona = $this->Auth->identify();
if ($persona) {
$this->Auth->setUser($persona);
return $this->redirect($this->Auth->redirectUrl());
}
$this->Flash->error(‘Tu nombre o password es incorrecto.’);
var_dump($persona);
}
}

  public function logout() {
    $this->Authentication->logout();
}

(At the end i didnt find out how to insert or put these codes, sorry)

Without the // the page of login needs to “where the USERS controller” not Persona controller, that was reason of being bit frustrated.
Any help is needed. Thanks.

as @Zuluru said you need to change model from which user data is taken

https://book.cakephp.org/3.0/en/controllers/components/authentication.html#configuring-authentication-handlers

there is userModel setting which defaults to Users, change it to your needs

so basically its:

$this->Auth->config(‘authenticate’, [
‘Basic’ => [‘personaModel’ => ‘persona’],
‘Form’ => [‘personaModel’ => ‘persona’]

    ]);

if i wanna change userModal to personaModel? and then writing the load component?

setting name is userModel not personaModel like in link

'Form' => ['userModel' => 'Members']

so for you it would be

'Form' => ['userModel' => 'Persona'] // note im not sure if its Persona or Personas just follow your lang inflection rules