trait AuthenticateUserTrait

Traits

Properties

protected Dispatcher $bus

Methods

withRememberCookie(ResponseInterface $response, $token)

No description

withForgetCookie(ResponseInterface $response)

No description

HtmlResponse
authenticate(array $identification, array $suggestions = [])

<p>Respond with JavaScript to inform the Flarum app about the user's authentication status.</p>

Details

protected withRememberCookie(ResponseInterface $response, $token)

Parameters

ResponseInterface $response
$token

protected withForgetCookie(ResponseInterface $response)

Parameters

ResponseInterface $response

protected HtmlResponse authenticate(array $identification, array $suggestions = [])

<p>Respond with JavaScript to inform the Flarum app about the user's authentication status.</p>

<p>An array of identification attributes must be passed as the first argument. These are checked against existing user accounts; if a match is found, then the user is authenticated and logged into that account via cookie. The Flarum app will then simply refresh the page.</p> <p>If no matching account is found, then an AuthToken will be generated to store the identification attributes. This token, along with an optional array of suggestions, will be passed into the Flarum app's sign up modal. This results in the user not having to choose a password. When they complete their registration, the identification attributes will be set on their new user account.</p>

Parameters

array $identification
array $suggestions

Return Value

HtmlResponse