NOTE: I had to correct issues in the SessionHandler function as well as the WebLoginPE Snippet itself to get AutoLogin to work correctly...
Regardless, now we have AutoLogin working which is nice...
I created a custom "Change Email/Password" form leveraging MODx System Events for the data validation...however, if a user changes their password, this "breaks" the AutoLogin requiring the user to Login manually the next time they access the site...
The Request:
It makes sense the user has to re-login since the Cookie that was initially created has the original password intact. So, one solution might be to tie an event to
OnWebChangePassword and have that event reset the WebLoginPE cookie...
Unfortunately, I see no interface via the API to "redeclare" the WLPE cookies.
It would be nice if the cookie creation/destroy logic was moved into methods of the API, so that they can be invoked during onWebChangePassword to keep AutoLogin seamless--even after a password change
The function could be set up to accept the following parameters:
cookieName, cookieValue, cookieExpires
However, it might make more sense to allow it to accept
username and
password so that the MD5 can take place within the function, rather than before:
$cookieValue = md5($this->User['username']).'|'.$this->User['password'];
Then, it could also be used the way it is today, or also during with password changes.