Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba

Issue with custom user login and group redirect


Go to End
Reply


771 Views

Avatar
lozhowlett

Community Member, 151 Posts

19 October 2011 at 10:24pm

Hi everyone

I have been using this tut > http://www.ssbits.com/tutorials/2009/custom-login-form-with-group-based-redirection/

And we did have a perfectly working site, however it seems to error now!

[User Warning] Already directed to /admin; now trying to direct to /
POST /Security/LoginForm

Line 464 in /var/sites/c/cmpe.co.uk/public_html/sapphire/core/control/Controller.php

Source

455 		}
456 	}
457 	
458 	/**
459 	 * Redirct to the given URL.
460 	 * It is generally recommended to call Director::redirect() rather than calling this function directly.
461 	 */
462 	function redirect($url, $code=302) {
463 		if($this->response->getHeader('Location')) {
464 			user_error("Already directed to " . $this->response->getHeader('Location') . "; now trying to direct to $url", E_USER_WARNING);
465 			return;
466 		}
467 
468 		// Attach site-root to relative links, if they have a slash in them
469 		if($url == "" || $url[0] == '?' || (substr($url,0,4) != "http" && $url[0] != "/" && strpos($url,'/') !== false)){
470 			$url = Director::baseURL() . $url;
Trace

Already directed to /admin; now trying to direct to / 
Line 464 of Controller.php
Controller->redirect(/,302) 
Line 410 of Director.php
Director::redirect(/) 
Line 7 of MyLogin.php
MyLogin->dologin(Array,MyLogin,SS_HTTPRequest) 
Line 332 of Form.php
Form->httpSubmission(SS_HTTPRequest) 
Line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest) 
Line 161 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest) 
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest) 
Line 282 of Director.php
Director::handleRequest(SS_HTTPRequest,Session) 
Line 125 of Director.php
Director::direct(/Security/LoginForm) 
Line 127 of main.php

MyLogin.php > http://www.sspaste.com/paste/show/4e9e9cbf88a41

GroupDecorator.php > http://www.sspaste.com/paste/show/4e9e9ce32f592

_config includes

//custom login
Object::add_extension('Group', 'GroupDecorator');

Any ideas how to fix this? Thanks!
Object::useCustomClass('MemberLoginForm', 'MyLogin');