Xety / Cake3-CookieAuth

A simple Cake 3 plugin to automatically authenticate users with Cookies.
http://xeta.io
MIT License
18 stars 13 forks source link

Allow NULL password #7

Open johanvanderkuijl opened 8 years ago

johanvanderkuijl commented 8 years ago

I user LDAP for authentication, so I don't store passwords in my users table.

// after authentication by LDAP
$this->Cookie->write('CookieAuth', [
    'username' => $this->request->data('username'),
    'password' => null 
]);

I still want users to be identified by the username, so I had to comment a line out

if (empty($cookies[$username]) /*|| empty($cookies[$password])*/) {
    return false;
}

// the user can be found by his username. The password field is not mandatory
// in BaseAuthenticate.php
$user = $this->_findUser($cookies[$username], $cookies[$password]);
if ($user) {
    return $user;
}

Is this reasonable?