I’ve started going through the process to migrate a fairly large app from v4.6 to v5.3.5.
So far, I’ve gone fairly well and I’m presented with a login screen - not too bad for an afternoon’s work ![]()
Now that I’m tying to log in, I’ve struck a problem with a supposedly invalid password
In v4 I had the following
$authenticationService = new AuthenticationService([
'unauthenticatedRedirect' => Router::url('/users/login'),
'queryParam' => 'redirect',
]);
// Load identifiers, ensure we check email and password fields
$authenticationService->loadIdentifier('Authentication.Password', [
'fields' => [
'username' => 'email_address',
'password' => 'password',
],
'resolver' => [
'className' => 'Authentication.Orm',
'userModel' => 'Users',
'finder' => 'userDetails' // Customer Finder that returns associated Member record
]
]);
// Load the Session impersonate authenticator first, lets us act as proxy on a users account
$authenticationService->loadAuthenticator(Authenticator\SessionImpersonateAuthenticator::class);
// Load the authenticators, you want session first
$authenticationService->loadAuthenticator('Authentication.Session');
// Configure form data check to pick email and password
$authenticationService->loadAuthenticator('Authentication.Form', [
'fields' => [
'username' => 'email_address',
'password' => 'password',
],
'loginUrl' => Router::url('/users/login'),
]);
In V5 I have the following
$authenticationService = new AuthenticationService();
// Define where users should be redirected to when they are not authenticated
$authenticationService->setConfig([
'unauthenticatedRedirect' => [
'prefix' => false,
'plugin' => false,
'controller' => 'Users',
'action' => 'login',
],
'queryParam' => 'redirect',
]);
$fields = [
'username' => 'email_address',
'password' => 'password',
];
// Load the authenticators. Session should be first.
// Session just uses session data directly as identity, no identifier needed.
$authenticationService->loadAuthenticator('Authentication.Session');
$authenticationService->loadAuthenticator('Authentication.Form', [
'identifier' => [
'className' => 'Authentication.Password',
'fields' => $fields,
],
'fields' => $fields,
'loginUrl' => Router::url([
'prefix' => false,
'plugin' => null,
'controller' => 'Users',
'action' => 'login',
]),
]);
// Load the Session impersonate authenticator first, lets us act as proxy on a users account
$authenticationService->loadAuthenticator(Authenticator\SessionImpersonateAuthenticator::class);
I’ve tried following the documentation as best I can but I’ve run out of ideas.
Any assistance/greatly appreciated
Regards,
Brian