31 lines
1.2 KiB
PHP
31 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace IriksIT\Manager\Contracts;
|
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
use Illuminate\Http\Request;
|
|
|
|
/**
|
|
* Something more a login asks for: a captcha, a code from an authenticator app, a field of the site's own. List the class in
|
|
* `manager.login.checks`. A check fails a login by throwing `Illuminate\Validation\ValidationException`.
|
|
*/
|
|
interface LoginCheck
|
|
{
|
|
/**
|
|
* What the login form shows besides the email and the password. Each entry has a `name` (the key in the request) and a `type`:
|
|
* `text`, `password`, `number` or `turnstile` (with a `site_key`); and optionally a `label`, `autocomplete` and `required`.
|
|
*
|
|
* @return list<array<string, mixed>>
|
|
*/
|
|
public function fields(): array;
|
|
|
|
/** Runs first, before the password is looked at: a captcha belongs here. */
|
|
public function before(Request $request): void;
|
|
|
|
/**
|
|
* Runs when the email and password are right, before anyone is logged in: a second factor belongs here. When it refuses, the
|
|
* attempt counts as a failed login (the audit log and the bans see it).
|
|
*/
|
|
public function after(Request $request, Authenticatable $user): void;
|
|
}
|