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 /

Help internationalizing the login page


Reply


3 Posts   460 Views

Avatar
vodoomoth

Community Member, 22 Posts

29 January 2013 at 4:17am

Edited: 29/01/2013 4:17am

Hi,

In the wake of [url=http://www.silverstripe.org/customising-the-cms/show/21811]my previous efforts[/url] to internationalize the login page, I am now trying to extend the MemberAuthenticator class with a custom class.

The reason I'm trying to do that is that despite my aforementioned efforts, error messages still appear in en_US when the page is normally in fr_FR. To solve that problem, I've realized that I need to add a call to i18n::set_locale() in the static function MemberAuthenticator::authenticate.

I have created a subclass to MemberAuthenticator that does just that, added

Object::useCustomClass('MemberAuthenticator', 'MyMemberAuthenticator');


in mysite/_config.php, and run /dev/build.

And yet, using XDebug and Eclipse, I see that the standard MemberAuthenticator still gets called in lieu of my custom class, the file of which I've dropped in mysite/code/security/MyMemberAuthenticator.php. Is there something I did wrong?

Thank you.

Avatar
Tony Air

Community Member, 13 Posts

21 February 2013 at 5:20pm

Hi,
I had the same issue. Solution is to create your own security controller for an instance "SecurityExtended" and rewrite Director rules by routes.yml

Here's an example:

---
Name: zz-basicroutes
---
Director:
rules:
'Security//$Action/$ID/$OtherID': 'SecurityExtended'

Cheers

Avatar
prvz

Community Member, 1 Post

12 April 2013 at 11:42am

Thanks Tony Air can You Please Explain How to extend the security controller and change it sorry I am a new bee to silver stripe.
I am finding harder to extend the internal classes and use it. Or if you can provide me link.