stage 1 of oauth removal, switch to sanctum pat tokens
This commit is contained in:
36
app/Http/Requests/Auth/TenantAdminTokenRequest.php
Normal file
36
app/Http/Requests/Auth/TenantAdminTokenRequest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class TenantAdminTokenRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'login' => ['required', 'string'],
|
||||
'password' => ['required', 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
public function credentials(): array
|
||||
{
|
||||
$login = $this->string('login')->trim()->value();
|
||||
|
||||
if (filter_var($login, FILTER_VALIDATE_EMAIL)) {
|
||||
return ['email' => $login, 'password' => $this->string('password')->value()];
|
||||
}
|
||||
|
||||
return ['username' => $login, 'password' => $this->string('password')->value()];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user