final class LoginService

Login policy: verifies credentials and applies the account rules (password-reset, inactive, failed-attempt lockout) as a returned LoginResult, leaving all HTTP behavior to the caller. Replaces the redirect-driven AuthService::login()/loginAttempts() flow.

Methods

static LoginResult
attempt(Input $request, Login $loginModel, string $username, bool $mailer = false)

Attempts to authenticate the given username. On success the user is logged in via the guard and their failed-attempt counter reset; on failure, attempts are tracked and the account locked past the configured maximum. No redirects or flash messages are issued — the outcome is returned for the caller to act on.

static LoginResult
registerFailedAttempt(Users $user, Login $loginModel, bool $mailer = false)

Tracks a failed login attempt: locks the account once the configured maximum is reached, optionally emails on the transition into the locked state, records the appropriate failure message, and increments the attempt counter. Ports AuthService::loginAttempts() verbatim, returning a LoginResult in place of the Login model.

Details

at line 34
static LoginResult attempt(Input $request, Login $loginModel, string $username, bool $mailer = false)

Attempts to authenticate the given username. On success the user is logged in via the guard and their failed-attempt counter reset; on failure, attempts are tracked and the account locked past the configured maximum. No redirects or flash messages are issued — the outcome is returned for the caller to act on.

Parameters

Input $request

The login request (supplies the password).

Login $loginModel

The login model; failure messages are added to it, matching the prior behavior.

string $username

The submitted username.

bool $mailer

Whether to send the account-deactivated email when an account crosses into the locked state.

Return Value

LoginResult

The outcome of the attempt.

at line 86
static private LoginResult registerFailedAttempt(Users $user, Login $loginModel, bool $mailer = false)

Tracks a failed login attempt: locks the account once the configured maximum is reached, optionally emails on the transition into the locked state, records the appropriate failure message, and increments the attempt counter. Ports AuthService::loginAttempts() verbatim, returning a LoginResult in place of the Login model.

Parameters

Users $user

The user who failed to authenticate.

Login $loginModel

The login model; the failure message is added to it when the account is not yet locked.

bool $mailer

Whether to send the deactivation email on the transition into the locked state.

Return Value

LoginResult

INVALID while attempts remain, LOCKED once the account has been locked.