# |
Aug 30th 2019, 13:21 |
yadav.manu36 |
this is right? |
# |
Aug 30th 2019, 13:21 |
slackebot2 |
'prefix' => 'admin', "plugin" => 'AdminUserManager' ], 'urlChecker' => CakeRouterUrlChecker::class, ]); |
# |
Aug 30th 2019, 13:21 |
yadav.manu36 |
@ricksaccous $service->loadAuthenticator('Authentication.Form', [ 'fields' => $fields, 'loginUrl' => [ 'controller' => 'AdminUsers', 'action' => 'login', 'prefix' => 'admin', "plugin" => 'AdminUserManager' ], 'logoutRedirect' => [ 'controller' => 'AdminUsers', 'action' => 'logout', |
# |
Aug 30th 2019, 13:18 |
ricksaccous |
@yadav.manu36 you need 'urlChecker' => CakeRouterUrlChecker::class |
# |
Aug 30th 2019, 13:17 |
ricksaccous |
$service->loadAuthenticator( 'Authentication.Form', [ 'fields' => $fields, 'urlChecker' => CakeRouterUrlChecker::class, 'loginUrl' => [ 'plugin' => 'Users', 'prefix' => false, 'controller' => 'Users', 'action' => 'login' ] ] ); |
# |
Aug 30th 2019, 13:17 |
ricksaccous |
because by default it won't recognized the array routes |
# |
Aug 30th 2019, 13:17 |
ricksaccous |
in the form login set up |
# |
Aug 30th 2019, 13:17 |
ricksaccous |
nah he needs to specify a class |
# |
Aug 30th 2019, 13:15 |
javier.villanueva |
'unauthenticatedRedirect' => Router::url([ 'controller' => 'AdminUsers', 'action' = 'login' ]), |
# |
Aug 30th 2019, 13:15 |
javier.villanueva |
in middleware you can try... |
# |
Aug 30th 2019, 13:13 |
yadav.manu36 |
AdminUserManager is my plugin name and i have been used DashedRoute for this |
# |
Aug 30th 2019, 13:13 |
yadav.manu36 |
yes |
# |
Aug 30th 2019, 13:12 |
javier.villanueva |
http://localhost/admin/admin-user-manager/admin-users/login ? |
# |
Aug 30th 2019, 13:12 |
javier.villanueva |
the url is correct? |
# |
Aug 30th 2019, 13:08 |
yadav.manu36 |
yes |
# |
Aug 30th 2019, 13:08 |
javier.villanueva |
same error? |
# |
Aug 30th 2019, 13:08 |
yadav.manu36 |
I am follow this but still not working |
# |
Aug 30th 2019, 12:59 |
javier.villanueva |
but sorry, I dont use this plugin |
# |
Aug 30th 2019, 12:59 |
javier.villanueva |
$service->loadIdentifier('Authentication.Password', [ 'fields' => [ 'username' => 'email', 'password' => 'password', ], 'resolver' => [ 'className' => 'Authentication.Orm', 'finder' => 'active' 'userModel' => 'AdminUsers', ], |
# |
Aug 30th 2019, 12:58 |
javier.villanueva |
I think that you need |
# |
Aug 30th 2019, 12:57 |
yadav.manu36 |
Thanks @javier.villanueva for your effort |
# |
Aug 30th 2019, 12:57 |
yadav.manu36 |
you are right, but table structure already exists so i need this. now i am going to check with ORM Resolver section |
# |
Aug 30th 2019, 12:54 |
javier.villanueva |
and then try to change to your complex config |
# |
Aug 30th 2019, 12:54 |
javier.villanueva |
I think that is better if you check first that plugin works with default config |
# |
Aug 30th 2019, 12:53 |
javier.villanueva |
ORM Resolver section |
# |
Aug 30th 2019, 12:53 |
javier.villanueva |
I think that you need specify your new model in userModel |
# |
Aug 30th 2019, 12:53 |
javier.villanueva |
https://book.cakephp.org/authentication/1.1/en/identifiers.html |
# |
Aug 30th 2019, 12:52 |
yadav.manu36 |
but my controller name is AdminUsersController and my table name is admin_users |
# |
Aug 30th 2019, 12:51 |
yadav.manu36 |
it this? |
# |
Aug 30th 2019, 12:51 |
yadav.manu36 |
'loginUrl' => [ 'controller' => 'adminUsers', |
# |
Aug 30th 2019, 12:50 |
javier.villanueva |
the problem is that default config is hoping "users" not "adminUsers" |
# |
Aug 30th 2019, 12:49 |
yadav.manu36 |
@javier.villanueva please check above flow |
# |
Aug 30th 2019, 12:48 |
slackebot2 |
$this->Authentication->allowUnauthenticated(['login', 'logout']); 7. My login Method ----- public function login() { $result = $this->Authentication->getResult(); if ($this->request->is('post')) { if ($result->isValid()) { |
# |
Aug 30th 2019, 12:48 |
slackebot2 |
"plugin" => 'AdminUserManager' ], 'logoutRedirect' => [ 'controller' => 'adminUsers', 'action' => 'login', 'prefix' => 'admin', "plugin" => 'AdminUserManager' ] ]); return $service; } 6. and last one load component in appController ----------- $this->loadComponent('Authentication.Authentication'); |
# |
Aug 30th 2019, 12:48 |
slackebot2 |
$middlewareQueue->add($authentication) 5. Added getAuthenticationService method in application.php ---- public function getAuthenticationService(ServerRequestInterface $request, ResponseInterface $response) { $service = new AuthenticationService(); $fields = [ 'username' => 'email', 'password' => 'password' ]; // Load identifiers |
# |
Aug 30th 2019, 12:48 |
slackebot2 |
$service->loadIdentifier('Authentication.Password', compact('fields')); // Load the authenticators, you want session first $service->loadAuthenticator('Authentication.Session'); $service->loadAuthenticator('Authentication.Form', [ 'fields' => $fields, 'loginUrl' => [ 'controller' => 'adminUsers', 'action' => 'login', 'prefix' => 'admin', |
# |
Aug 30th 2019, 12:48 |
slackebot2 |
In bootstrap method added plugin ---- public function bootstrap() { $this->addPlugin('Authentication'); 4. Added AuthenticationMiddleware in middleware method. ---- public function middleware($middlewareQueue) { $authentication = new AuthenticationMiddleware($this, [ 'unauthenticatedRedirect' => \Cake\Routing\Router::url('AdminUserManager.admin_users:login'), 'queryParam' => 'redirect', ]); |
# |
Aug 30th 2019, 12:48 |
yadav.manu36 |
1. First i have used namespace in Application.php ---- use Authentication\AuthenticationService; use Authentication\AuthenticationServiceProviderInterface; use Authentication\Middleware\AuthenticationMiddleware; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; 2. After That I have implement interface --- class Application extends BaseApplication implements AuthenticationServiceProviderInterface 3. |
# |
Aug 30th 2019, 12:42 |
yadav.manu36 |
ok, wait |
# |
Aug 30th 2019, 12:41 |
javier.villanueva |
I need more information to help you |
# |
Aug 30th 2019, 12:41 |
javier.villanueva |
your steps... add the plugin to bootstrap, add the middleware, create login function? |