# |
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? |
# |
Aug 30th 2019, 12:40 |
javier.villanueva |
ok |
# |
Aug 30th 2019, 12:39 |
yadav.manu36 |
Yes, I know but after some time it will deprecated. so i want go with authentication plugin |
# |
Aug 30th 2019, 12:38 |
javier.villanueva |
but... in what step are you stuck? |
# |
Aug 30th 2019, 12:38 |
javier.villanueva |
I think that AuthComponent is more easy to use |
# |
Aug 30th 2019, 12:36 |
yadav.manu36 |
but i am stuck in this functionality now |
# |
Aug 30th 2019, 12:36 |
yadav.manu36 |
I am implementing auth functionality for my new project |
# |
Aug 30th 2019, 12:32 |
javier.villanueva |
what are you doing? |
# |
Aug 30th 2019, 12:27 |
yadav.manu36 |
I can't move forward. so please help me. |
# |
Aug 30th 2019, 12:25 |
yadav.manu36 |
I am stuck now |
# |
Aug 30th 2019, 12:24 |
javier.villanueva |
I use AuthComponent sorry |
# |
Aug 30th 2019, 12:23 |
yadav.manu36 |
i am using CakePHP 3.8.2 version |
# |
Aug 30th 2019, 12:23 |
javier.villanueva |
ok ok |
# |
Aug 30th 2019, 12:23 |
yadav.manu36 |
No this is CakePHP Authentication 1.1 version |
# |
Aug 30th 2019, 12:23 |
javier.villanueva |
ahm not...sorry |
# |
Aug 30th 2019, 12:22 |
javier.villanueva |
what version do you use? |
# |
Aug 30th 2019, 12:22 |
javier.villanueva |
but this is cakephp 1 doc |
# |
Aug 30th 2019, 12:21 |
yadav.manu36 |
@javier.villanueva i am follow this example : https://book.cakephp.org/authentication/1.1/en/index.html |
# |
Aug 30th 2019, 12:20 |
javier.villanueva |
or what plugin? |
# |
Aug 30th 2019, 12:20 |
javier.villanueva |
are you using https://book.cakephp.org/3.0/en/controllers/components/authentication.html ? |
# |
Aug 30th 2019, 12:16 |
yadav.manu36 |
Hi I am struggling to login using Authentication plugin so please help me. i have been getting below error also please check attached screenshot. Result {#76 ▼ #_status: "FAILURE_OTHER" #_data: null #_errors: array:1 [▼ 0 => "Login URL `http://localhost/admin/admin-user-manager/admin-users/login` did not match `adminUsers` or `login` or `admin` or `AdminUserManager`." ] } |
# |
Aug 30th 2019, 11:27 |
admad |
@javier.villanueva use CrudView plugin and you won't have to bake templated :slightly_smiling_face: |
# |
Aug 30th 2019, 11:12 |
else-where |
I had used `Creator` or `Modifier` , `creator_id` and `modifier_id` but like `created_by_id` also make a sense. |
# |
Aug 30th 2019, 10:56 |
spriz |
yars |
# |
Aug 30th 2019, 10:42 |
neon1024 |
Then I can have an association of `CreatedByUser` and property of `created_by_user` with a User entity in :) |
# |
Aug 30th 2019, 10:42 |
neon1024 |
Gone with `created_by_user_id` 8) |
# |
Aug 30th 2019, 10:42 |
slackebot2 |
Action: neon1024 quickly adds |