3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 414 Views |
-
Custom Login Template depending on Viewer Group

1 December 2011 at 5:06am
Hello all,
I want to show custom Login Templates for admins and clients trying to log in on the site.
Therefore I would have to know to which Viewer Group that page belongs (client or admin).I have already the basic setup to perform a switch...
I have a custom loginform (CustomLoginForm.php) class, which I enabled using this in config.php:Object::useCustomClass('MemberLoginForm', 'CustomLoginForm');
To use a custom template for the login form you just have to put a file named "Security_login.ss" in the Layout folder.
So far so good.
In CustomLoginForm.php I want to check the Viewer Group of the visited page with a function.
But I do not know how to get that info. So far I can access $_REQUEST['BackURL'], which is /admin or /client/something.
I could to the switch on that BackURL, but that doesn´t seem to be a cool solution
Does anyone know better?
Many thanks,
Florian -
Re: Custom Login Template depending on Viewer Group

5 December 2011 at 9:18pm
Hi,
perhaps the following approaches work for you:
Inside your Form
1. Get the instance of the current controller and check the className:
$cont = Controller::curr();
if( $cont instanceof YourPageType_Controller ) {
// do this
} else {
//do that
}2. evaluate the ViewerGroups of the current controller (the security groups that have access to the controller)
$cont = Controller::curr();
$groups = $cont->ViewerGroups(); // this is basically a many_many component setDoes this help?
Robert
| 414 Views | ||
|
Page:
1
|
Go to Top |


