Andudi Posted October 13, 2015 Share Posted October 13, 2015 dear all I try to implement another kind of login/logout redirection in a module. I have found some concerning methodes in ProcessLogin that I try to call in the init() methode of my module: class ProcessLoginRedirect extends ProcessLogin { public static function getModuleInfo() { return array( 'title' => 'Login Redirect', 'version' => 1, 'summary' => 'Define constant redirect page for login and logout process.', 'autoload' => true ); } public function init() { parent::init(); // required $this->setLoginURL('/'); $this->setLogoutURL('/'); } } for testing, I try to redirect to the homepages frontend ('/'), but this does not work at all... I suppose, that this code is not called at all... what do I wrong? what could I do for debugging? thanks for help Link to comment Share on other sites More sharing options...
LostKobrakai Posted October 13, 2015 Share Posted October 13, 2015 You're extending the existing class, but processwire does probably still just call the parent instead of your new child class. To make it call your module instead of the core one you need to edit the process field of the /admin/login page. Link to comment Share on other sites More sharing options...
Andudi Posted October 14, 2015 Author Share Posted October 14, 2015 thank you for your answer LostKobrakai my idea was too simple tough... but yes, now I got it: the process field in the edit page of /admin/login... setting to my new class (ProcessLoginRedirect) overwrites the one of the core module (ProcessLogin)... ... and it works fine now... but only for the admin user! If I login as normal user I get the following Error in the header: TemplateFile: You don't have permission any good idea wher I should digg? thanks in advance. Andreas Link to comment Share on other sites More sharing options...
Andudi Posted October 15, 2015 Author Share Posted October 15, 2015 hm, seems not to be that simple... and I think to extend ProcessLogin and call the setLoginURL method is not the right way to do it... Next I tried to hook the ___execute() method of ProcessLogin and call setLoginURL there... works but then I have no information about the user and I failed to create a filter. Now my solution is to hook ___loginSuccess($user) of the Session class... now I have access to the user and can use $session->redirect depending of the users settings (defined with an additional field at the user page). For me this topic can be closed. But I think since I found a bunch of forum questions about that (since I do not want to rewrite the login page, they do not really help me) that it could be explained somewhere how this is meant by the devs. thank you for your great work, since PW is much more intuitive than any other CMS I tried! Andreas Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now