eZ Community » Blogs » Thiago Campos Viana » Tip: Custom login handler

By

Tip: Custom login handler

Saturday 05 November 2011 1:09:38 am

  • Currently 3 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

I've been creating modules views to handle special users login but there is a better way to do that, you can just create a custom login handler.

So you need to create an extension with at least two folders, settings and login_handler, this way:

  • extension
    • myext
      • settings
      • login_handler

Inside settings folder create the site.ini.append.php file:

<?php /*
 
 
[UserSettings]
ExtensionDirectory[]=myext
LoginHandler[]=MyLogin
 
 
*/ ?>

Inside login_handler folder create the file ezmyloginuser.php (needs to end with user.php), with the content (just a sample):

<?php
 
class eZMyLoginUser extends eZUser
{
 
    function eZMyLoginUser()
    {
    }
 
    static function loginUser( $login, $password, $authenticationMatch = false )
    {
        /* Code goes here */
    }
}

That's it! Now ez will use your class before default login handler. See also:

Tip: Google Login sample code

Proudly Developed with from