Is it possible to configure CakeDC's Users plugin to use email field as a username?
By default there are both username and email fields in Users plugin and all work great! But I would like to use email as the username for the authentication, so the user registration can be simplified.
I have tried overriding the UsersAuthComponent by loading Auth component in the AppController, but login stops working and says "Wrong username or password".
public function initialize()
{
parent::initialize();
$this->loadComponent('Flash');
$this->loadComponent('Auth', [
'loginAction' => [
'plugin' => 'CakeDC/Users',
'controller' => 'Users',
'action' => 'login',
],
'authenticate' => [
'all' => [
'scope' => ['active' => 1]
],
'CakeDC/Users.RememberMe',
'Form' => [
'fields' => ['username' => 'email', 'password' => 'password']
]
],
'authorize' => [
'CakeDC/Users.Superuser',
'CakeDC/Users.SimpleRbac',
],
'storage' => 'Session'
]);
$this->loadComponent('CakeDC/Users.UsersAuth');
}
Following the documentation, I also turned off the UsersAuthComponent in bootstrap.php.
Configure::write('Users.auth', false);
Is there a trick? I believe it is possible, or maybe a bug?
I am using CakePHP 3.1 and CakeDC User plugin 3.1