refactor: auto refactor via rector
This commit is contained in:
@@ -10,7 +10,7 @@ class Logout
|
||||
/**
|
||||
* Log the current user out of the application.
|
||||
*/
|
||||
public function __invoke()
|
||||
public function __invoke(): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
Auth::guard('web')->logout();
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class ResetPassword extends Component
|
||||
// database. Otherwise we will parse the error and return the response.
|
||||
$status = Password::reset(
|
||||
$this->only('email', 'password', 'password_confirmation', 'token'),
|
||||
function ($user) {
|
||||
function ($user): void {
|
||||
$user->forceFill([
|
||||
'password' => Hash::make($this->password),
|
||||
'remember_token' => Str::random(60),
|
||||
|
||||
@@ -39,7 +39,7 @@ class RecoveryCodes extends Component
|
||||
|
||||
if ($user->hasEnabledTwoFactorAuthentication() && $user->two_factor_recovery_codes) {
|
||||
try {
|
||||
$this->recoveryCodes = json_decode(decrypt($user->two_factor_recovery_codes), true);
|
||||
$this->recoveryCodes = json_decode((string) decrypt($user->two_factor_recovery_codes), true);
|
||||
} catch (Exception) {
|
||||
$this->addError('recoveryCodes', 'Failed to load recovery codes');
|
||||
|
||||
|
||||
@@ -60,21 +60,16 @@ class DashPanelProvider extends PanelProvider
|
||||
->plugins([
|
||||
FilamentLoggerPlugin::make(),
|
||||
FilamentLogViewerPlugin::make(),
|
||||
FilamentMailsPlugin::make()->canManageMails(function () {
|
||||
FilamentMailsPlugin::make()->canManageMails(function (): bool {
|
||||
$user = Auth::user();
|
||||
|
||||
// Allow access for users with specific roles
|
||||
if ($user->hasRole('admin')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow access for users with specific permissions
|
||||
if ($user->hasPermissionTo('manage mails')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Restrict access for all other users
|
||||
return false;
|
||||
return (bool) $user->hasPermissionTo('manage mails');
|
||||
}),
|
||||
])
|
||||
->routes(fn () => FilamentMails::routes());
|
||||
|
||||
@@ -23,11 +23,9 @@ class FortifyServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Fortify::twoFactorChallengeView(fn () => view('livewire.auth.two-factor-challenge'));
|
||||
Fortify::confirmPasswordView(fn () => view('livewire.auth.confirm-password'));
|
||||
Fortify::twoFactorChallengeView(fn (): \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory => view('livewire.auth.two-factor-challenge'));
|
||||
Fortify::confirmPasswordView(fn (): \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory => view('livewire.auth.confirm-password'));
|
||||
|
||||
RateLimiter::for('two-factor', function (Request $request) {
|
||||
return Limit::perMinute(5)->by($request->session()->get('login.id'));
|
||||
});
|
||||
RateLimiter::for('two-factor', fn(Request $request) => Limit::perMinute(5)->by($request->session()->get('login.id')));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user