checkCredentials

The checkCredentials hook is triggered when a login attempt fails due to a wrong password. It passes the username and password as well as the user object as arguments and expects a boolean as return value.

Available

from Contao 2.6.0.

Parameters

  1. string $strUsername

    The username submitted from the login form.

  2. string $strPassword

    The password submitted from the login form.

  3. User $objUser

    User object model from database record with the given username.

Return Values

Return true if you accept the username/password combination for login, or false otherwise.

Example

<?php

// config.php
$GLOBALS['TL_HOOKS']['checkCredentials'][] = array('MyClass', 'myCheckCredentials');

// MyClass.php
public function myCheckCredentials($strUsername, $strPassword, User $objUser)
{
    // Check against a global database
    if ($this->checkGlobalDbFor($strUsername, $strPassword))
    {
        return true;
    }

    return false;
}

More information

References

See also

  • importUser - triggered when username cannot be found in the database.
  • postLogin - triggered after a user has logged in.
  • postLogout - triggered after a user has logged out.

results matching ""

    No results matching ""