PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, November 1, 2022

[FIXED] how to give loginredirect in cakedc, Cakephp 3.0

 November 01, 2022     cakedc, cakephp, routes     No comments   

Issue

How to give loginredirect in cakephp while using cakedc Users plugin and also tell where these changes are to be done src/controller/AppController or vendor/cakedc/users/src/Controller/AppController

AppContoller of cakedc users plugin
    class AppController extends BaseController
    {
        public function initialize()
        {
            parent::initialize();
            $this->loadComponent('Security');
            $this->loadComponent('Csrf');
            $this->loadComponent('CakeDC/Users.UsersAuth', ['loginAction' => ['controller' => 'Blogs','action' => 'index']]);
         }
    }

Solution

You can update defaults in Auth component configuration after the plugin is loaded, like this:

$this->Auth->config('loginAction', [...your url...]);

Or you can use the config based plugin initialization as suggested here https://github.com/CakeDC/users/blob/master/Docs/Documentation/Configuration.md



Answered By - steinkel
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing