Documentation

Login

Use case for user login.

Handles authentication with username/email and password.

Tags
since
3.0.0

Table of Contents

Constants

SESSION_TOKEN  = 'LWT_SESSION_TOKEN'
Session key for storing the session token (for CSRF protection).
SESSION_USER_ID  = 'LWT_USER_ID'
Session key for storing the user ID.

Properties

$passwordHasher  : PasswordHasher
Password hasher.
$repository  : UserRepositoryInterface
User repository.

Methods

__construct()  : mixed
Create a new Login use case.
execute()  : User
Execute the login.
createSession()  : void
Create a session for the authenticated user.

Constants

SESSION_TOKEN

Session key for storing the session token (for CSRF protection).

private mixed SESSION_TOKEN = 'LWT_SESSION_TOKEN'

SESSION_USER_ID

Session key for storing the user ID.

private mixed SESSION_USER_ID = 'LWT_USER_ID'

Properties

Methods

execute()

Execute the login.

public execute(string $usernameOrEmail, string $password) : User
Parameters
$usernameOrEmail : string

Username or email

$password : string

Plain-text password

Tags
throws
AuthException

If authentication fails

Return values
User

The authenticated user

createSession()

Create a session for the authenticated user.

private createSession(User $user) : void
Parameters
$user : User

The authenticated user


        
On this page

Search results