LoginResult
final class LoginResult
Immutable result of a login attempt. Carries the outcome as a status constant plus, where relevant, the user the attempt concerned. Lets the login policy (LoginService) decide the outcome while the caller (controller) owns the resulting HTTP behavior — redirects, flash messages — rather than those being fired from inside the service.
Constants
| SUCCESS |
Credentials were valid and the user was logged in. |
| NEEDS_RESET |
Credentials were valid but the account is flagged for password reset. |
| INACTIVE |
Credentials were valid but the account is inactive. |
| LOCKED |
Credentials were invalid and the account is now locked. |
| INVALID |
Credentials were invalid (wrong password or unknown user). |
Methods
No description
Returns new instance with status set to self::INACTIVE.
Returns new instance with status set to self::INVALID.
Returns new instance with status set to self::LOCKED.
Determines if attempt is successful.
Details
at line 30
private
__construct(string $status, Principal|null $user = null)
No description
at line 40
static LoginResult
inactive()
Returns new instance with status set to self::INACTIVE.
at line 49
static LoginResult
invalid()
Returns new instance with status set to self::INVALID.
at line 58
static LoginResult
locked()
Returns new instance with status set to self::LOCKED.
at line 68
static LoginResult
needsReset(Principal $user)
Returns new instance with status set to self::NEEDS_RESET.
at line 77
bool
succeeded()
Determines if attempt is successful.
at line 87
static LoginResult
success(Principal $user)
Returns new instance with status set to self::SUCCESS.