• PHP reference
  • Login

LoginProvider

class Login\LoginProvider

Class LoginProvider.

Methods

__construct(Community $community = null)

Constructor.

Parameters

Exceptions

array sign_in(string $username, string $password)

Try to authenticate a user with a username and password.

This function always returns a plain array. The first item in that array (index 0) contains a value that indicates if the login was successful (if that value is (bool)true. If it wasn't, it contains a string that indicates the failure reason (user, sso, pass).

Parameters

  • string $username
  • string $password

Return Value

  • array (string|true $trueorerrorstring, stdClass|null $user, string|null $errordescription, string|null $authenticator)

boolean|object find_user_by_community(string $username_or_email)

Find a user by email address or community.

Tries to find a user that is part of the specified community, or any other community if a match for the current community can't be found. It checks both the username and email fields of users, and returns a plain database object of the user if any match was found, otherwise it returns false.

Parameters

  • string $username_or_email

Return Value

  • boolean|object

static startSession(User|object $user, Community|integer $community = null)

Start a authenticated session with a specific user.

Parameters