# |
Feb 11th 2020, 14:34 |
dereuromark |
its not. then that person doesnt understand basic things in life. |
# |
Feb 11th 2020, 14:33 |
admad |
then set table's `$_validatorClass` prpoerty to my class :) |
# |
Feb 11th 2020, 14:32 |
admad |
@lpj145 https://github.com/ADmad/cakephp-i18n/blob/master/src/Validation/Validator.php |
# |
Feb 11th 2020, 14:31 |
neon1024 |
I saw a tweet saying that calling it black and white lists is racist. |
# |
Feb 11th 2020, 14:29 |
lpj145 |
see: https://book.cakephp.org/3/en/controllers.html |
# |
Feb 11th 2020, 14:29 |
slackebot |
<lpj145> |
# |
Feb 11th 2020, 14:27 |
lpj145 |
looking for code, i understand what have one message for all entire rules. |
# |
Feb 11th 2020, 14:26 |
damiano |
same thing ? |
# |
Feb 11th 2020, 14:26 |
damiano |
should i unload it inside initialize() of PagesCOntroller or beforeFilter ? |
# |
Feb 11th 2020, 14:26 |
lpj145 |
@admad the validation lib have way to put default locale string ? |
# |
Feb 11th 2020, 14:25 |
damiano |
got it! |
# |
Feb 11th 2020, 14:25 |
dereuromark |
whitelist instead of blacklist :) |
# |
Feb 11th 2020, 14:25 |
damiano |
ok, makes sense |
# |
Feb 11th 2020, 14:24 |
admad |
it's always safer to secure the app globally and then disable it where not needed |
# |
Feb 11th 2020, 14:24 |
damiano |
ok |
# |
Feb 11th 2020, 14:24 |
damiano |
:) |
# |
Feb 11th 2020, 14:24 |
damiano |
(and obviously move the login/logout outside pagescontroller) |
# |
Feb 11th 2020, 14:23 |
admad |
you will surely need authentication at other places too in your app in future :) |
# |
Feb 11th 2020, 14:23 |
damiano |
so i can enable it inside the AppController there, no? |
# |
Feb 11th 2020, 14:23 |
damiano |
the users dashboard etc.. |
# |
Feb 11th 2020, 14:23 |
damiano |
i mean, inside that plugin i have all the controllers i need to protect |
# |
Feb 11th 2020, 14:23 |
damiano |
@admad but wait one moment, why not in AppController inside the Companies plugin ? |
# |
Feb 11th 2020, 14:22 |
damiano |
ok |
# |
Feb 11th 2020, 14:22 |
damiano |
@admad ah ok perfect, enable everywhere but inside the pagescontroller i will disable it |
# |
Feb 11th 2020, 14:21 |
admad |
@damiano load the component in AppController, put your login logout actions in UsersController instead of PagesController, unload component in PagesController::initialize() |
# |
Feb 11th 2020, 14:21 |
damiano |
yeah i have a form in login action |
# |
Feb 11th 2020, 14:21 |
lpj145 |
you have Password identifier ? |
# |
Feb 11th 2020, 14:20 |
lpj145 |
ok |
# |
Feb 11th 2020, 14:20 |
damiano |
but i load the component there because i do not need it for other pagescontroller's actions |
# |
Feb 11th 2020, 14:20 |
damiano |
i load it and check if the user is ok or not...if yes i redirect the logged user to protected area |
# |
Feb 11th 2020, 14:20 |
damiano |
yes look at the login action() |
# |
Feb 11th 2020, 14:19 |
lpj145 |
only Auth plugin can be auth if result is ok, redirect to company route. |
# |
Feb 11th 2020, 14:19 |
damiano |
```because if i load the Authentication components inside the main AppController i need to putt all the other PagesController actions in the $this->Authentication->allowUnauthenticated([here])``` |
# |
Feb 11th 2020, 14:18 |
lpj145 |
understand, but, why block all routes and enable only you need to be public ? |
# |
Feb 11th 2020, 14:18 |
slackebot |
$this->Flash->error('Invalid username or password'); } } |
# |
Feb 11th 2020, 14:18 |
damiano |
public function login() { $this->loadComponent('Authentication.Authentication'); $result = $this->Authentication->getResult(); // If the user is logged in send them away. if ($result->isValid()) { return $this->redirect(['controller' => 'Companies', 'action' => 'dashboard', 'plugin' => 'Companies']; } if ($this->request->is('post') andand !$result->isValid()) { |
# |
Feb 11th 2020, 14:16 |
slackebot |
there...because all the controller/action of the companies plugin must be protected |
# |
Feb 11th 2020, 14:16 |
damiano |
@lpj145 what do you mean? my entire PagesControler should be visible without authentication i only would like to enable the authentication component in /login and /logout because i need to call component's methods so i must enable it in those two actions... then after login when i check ->isValid() i willr edirect the logged user to CompaniesCOntroller inside Companies plugin...and i thought to enable "globally" the authentication components |
# |
Feb 11th 2020, 14:14 |
lpj145 |
@damiano you need to have public paths ? |
# |
Feb 11th 2020, 14:12 |
damiano |
my companiescontroller is inside a plugin i will enable the authentication there) NOT in the main AppController |
# |
Feb 11th 2020, 14:10 |
slackebot |
all the action must be protected |