Giter VIP home page Giter VIP logo

filament-breezy's Introduction

Filament Breezy cover art

Enhanced security for Filament v3+ Panels.

Latest Version on Packagist Total Downloads

Enhanced security features for Filament (v3) Panels. Includes a customizable My Profile page with personal info & avatar support, update password, two factor authentication, and Sanctum token management. Installs in minutes!

Features & Screenshots

My Profile - Personal info with avatar support Screenshot of Profile with avatar support Update password with customizable validation rules Screenshot of Two Factor codes Protected sensitive actions with a password confirmation modal Action Screenshot of Password confirmation action Two factor authentication with recovery codes Screenshot of Two Factor codes Force the user to enable two factor authentication before they can use the app Screenshot of forcing two factor auth Create and manage Sanctum personal access tokens Screenshot of Sanctum token management Screenshot of Sanctum token management

Installation

Install the package via composer and install:

composer require jeffgreco13/filament-breezy
php artisan breezy:install

Optionally, you can publish the views using:

php artisan vendor:publish --tag="filament-breezy-views"

Usage & Configuration

You must enable Breezy by adding the class to your Filament Panel's plugin() or plugins([]) method:

use Jeffgreco13\FilamentBreezy\BreezyCore;

class CustomersPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ...
            ->plugin(
                BreezyCore::make()
            )
    }
}

Update the auth guard

Breezy will use the authGuard set on the Filament Panel that you create. You may update the authGuard as you please:

use Jeffgreco13\FilamentBreezy\BreezyCore;

class CustomersPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ...
            ->authGuard('customers')
            ->plugin(
                BreezyCore::make()
            )
    }
}

NOTE: you must ensure that the model used in your Guard extends the Authenticatable class.

My Profile

Enable the My Profile page with configuration options.

NOTE: if you are using avatars,

BreezyCore::make()
    ->myProfile(
        shouldRegisterUserMenu: true, // Sets the 'account' link in the panel User Menu (default = true)
        shouldRegisterNavigation: false, // Adds a main navigation item for the My Profile page (default = false)
        navigationGroup: 'Settings', // Sets the navigation group for the My Profile page (default = null)
        hasAvatars: false, // Enables the avatar upload form component (default = false)
        slug: 'my-profile' // Sets the slug for the profile page (default = 'my-profile')
    )

Custom My Profile page class

You can also use a custom My Profile page class by extending the default one, and registering it with the plugin.

BreezyCore::make()
    ->myProfile()
    ->customMyProfilePage(AccountSettingsPage::class),

Using avatars in your Panel

The instructions for using custom avatars is found in the Filament v3 docs under Setting up user avatars.

Here is a possible implementation using the example from the docs:

use Illuminate\Support\Facades\Storage;
use Filament\Models\Contracts\HasAvatar;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements FilamentUser, HasAvatar
{
    // ...

    public function getFilamentAvatarUrl(): ?string
    {
        return $this->avatar_url ? Storage::url($this->avatar_url) : null ;
    }
}

Customize the avatar upload component

use Filament\Forms\Components\FileUpload;

BreezyCore::make()
    ->avatarUploadComponent(fn($fileUpload) => $fileUpload->disableLabel())
    // OR, replace with your own component
    ->avatarUploadComponent(fn() => FileUpload::make('avatar_url')->disk('profile-photos'))

Add column to table

If you wish to have your own avatar, you need to create a column on the users table named avatar_url. It is reccomended that you create a new migration for it, and add the column there:

php artisan make:migration add_avatar_url_column_to_users_table
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->string('avatar_url')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('avatar_url');
        });
    }
};

Add column to user model

    protected $fillable = [
        ...
        'avatar_url',
        ...
    ];

Customize password update

You can customize the validation rules for the update password component by passing an array of validation strings, or an instance of the Illuminate\Validation\Rules\Password class.

use Illuminate\Validation\Rules\Password;

BreezyCore::make()
    ->passwordUpdateRules(
        rules: [Password::default()->mixedCase()->uncompromised(3)], // you may pass an array of validation rules as well. (default = ['min:8'])
        requiresCurrentPassword: true, // when false, the user can update their password without entering their current password. (default = true)
        )

Exclude default My Profile components

If you don't want a default My Profile page component to be used, you can exclude them using the withoutMyProfileComponents helper.

BreezyCore::make()
    ->withoutMyProfileComponents([
        'update_password'
    ])

Create custom My Profile components

In Breezy v2, you can now create custom Livewire components for the My Profile page and append them easily.

  1. Create a new Livewire component in your project using:
php artisan make:livewire MyCustomComponent
  1. Extend the MyProfileComponent class included with Breezy. This class implements Actions and Forms.
use Jeffgreco13\FilamentBreezy\Livewire\MyProfileComponent;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;

class MyCustomComponent extends MyProfileComponent
{
    protected string $view = "livewire.my-custom-component";

    //

    public array $data;

    public function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('name')
                    ->required()
            ])
            ->statePath('data');
    }
}
  1. Within your Livewire component's view, you can use Breezy's grid-section blade component to match the style:
<x-filament-breezy::grid-section md=2 title="Your title" description="This is the description">
    <x-filament::card>
        <form wire:submit.prevent="submit" class="space-y-6">

            {{ $this->form }}

            <div class="text-right">
                <x-filament::button type="submit" form="submit" class="align-right">
                    Submit!
                </x-filament::button>
            </div>
        </form>
    </x-filament::card>
</x-filament-breezy::grid-section>
  1. Finally, register your new component with Breezy:
use App\Livewire\MyCustomComponent;

BreezyCore::make()
    ->myProfileComponents([MyCustomComponent::class])

Override My Profile components

You may override the existing MyProfile components to replace them with your own:

use App\Livewire\MyCustomComponent;

BreezyCore::make()
    ->myProfileComponents([
        // 'personal_info' => ,
        'update_password' => MyCustomComponent::class, // replaces UpdatePassword component with your own.
        // 'two_factor_authentication' => ,
        // 'sanctum_tokens' =>
    ])

If you want to customize only the fields and notification in the personal info component, you can extend the original breezy component:

namespace App\Livewire;

use Filament\Forms;
use Filament\Notifications\Notification;
use Jeffgreco13\FilamentBreezy\PersonalInfo;

class CustomPersonalInfo extends PersonalInfo
{
    protected function getNameComponent(): Forms\Components\TextInput
    {
        return Forms\Components\TextInput::make('custom_name_field')
            ->required();
    }

    protected function getEmailComponent(): Forms\Components\TextInput
    {
        return Forms\Components\TextInput::make('custom_email_field')
            ->required();
    }

    protected function sendNotification(): void
    {
        Notification::make()
            ->success()
            ->title('Saved Data!')
            ->send();
    }
}

Now, as mentioned above, give this component to BreezyCore::make()->myProfileComponents to override the original and use your custom component.

Sorting My Profile components

Custom MyProfile components can be sorted by setting their static $sort property. This property can be set for existing MyProfile components in any service provider:

TwoFactorAuthentication::setSort(4);

A lot of the time this won't be necessary, though, as the default sort order is spaced out in steps of 10, so there should be enough numbers to place any custom components in between.

Two Factor Authentication

  1. Add Jeffgreco13\FilamentBreezy\Traits\TwoFactorAuthenticatable to your Authenticatable model:
use Jeffgreco13\FilamentBreezy\Traits\TwoFactorAuthenticatable;

class User extends Authenticatable
{
    use HasApiTokens, HasFactory, Notifiable, TwoFactorAuthenticatable;
    // ...

}
  1. Enable Two Factor Authentication using the enableTwoFactorAuthentication() method on the Breezy plugin.
BreezyCore::make()
    ->enableTwoFactorAuthentication(
        force: false, // force the user to enable 2FA before they can use the application (default = false)
        action: CustomTwoFactorPage::class // optionally, use a custom 2FA page
    )
  1. Adjust the 2FA page

The Breezy 2FA page can be swapped for a custom implementation (see above), same as the Filament auth pages. This allows, for example, to define a custom auth layout like so:

use Jeffgreco13\FilamentBreezy\Pages\TwoFactorPage;

class CustomTwoFactorPage extends TwoFactorPage
{
    protected static string $layout = 'custom.auth.layout.view';
}

Sanctum Personal Access tokens

As of Laravel 8.x Sanctum is included with Laravel, but if you don't already have the package follow the installation instructions here.

Enable the Sanctum token management component:

BreezyCore::make()
    ->enableSanctumTokens(
        permissions: ['my','custom','permissions'] // optional, customize the permissions (default = ["create", "view", "update", "delete"])
    )

Password Confirmation Button Action

This button action will prompt the user to enter their password for sensitive actions (eg. delete). This action uses the same 'password_timeout' number of seconds found in config/auth.php.

use Jeffgreco13\FilamentBreezy\Actions\PasswordButtonAction;

PasswordButtonAction::make('secure_action')->action('doSecureAction')

// Customize the icon, action, modalHeading and anything else.
PasswordButtonAction::make('secure_action')->label('Delete')->icon('heroicon-s-shield-check')->modalHeading('Confirmation')->action(fn()=>$this->doAction())

Customizing the Registration form

Filament v3+ introduces enhanced capabilities for handling and customizing registration forms seamlessly. This feature is now an integral part of the core Filament functionality. Consequently, the ability to customize registration forms, which was available in Breezy v1, has been deprecated in v2 in favor of the more comprehensive and integrated approach provided by Filament v3+. Laravel Daily has a concise tutorial available, guiding users on creating and registering custom registration forms while incorporating additional fields. Check out the tutorial here for step-by-step instructions.

FAQ

How do 2FA sessions work across multiple panels?

By default, Breezy uses the same guard as defined on your Panel. The default is 'web'. Only panels that have registered the BreezyCore plugin will have access to 2FA. If multiple panels use 2FA, and share the same guard, the User only has to enter the OTP once for the duration of the session.

How does 2FA interact with MustVerifyEmail?

When 2FA is properly configured, and the User is prompted for the OTP code before email verification.

How long does the 2FA session last?

The 2FA session is the same as the Laravel session lifetime. Once the user is logged out, or the session expires, they will need to enter the OTP code again.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

filament-breezy's People

Contributors

andreapollastri avatar ap1969 avatar artrenh avatar ashleyhood avatar atmonshi avatar bfiessinger avatar boris-glumpler avatar caendesilva avatar chosten avatar chrissy-dev avatar daynnnnn avatar dependabot[bot] avatar ezimetyusup avatar felipe-balloni avatar franciscpd avatar github-actions[bot] avatar jeffgreco13 avatar jvkassi avatar mohamedsabil83 avatar pathros avatar pepperfm avatar phh avatar risangbaskoro avatar saade avatar sadegh19b avatar saifallak avatar sumardi avatar sweebee avatar underdpt avatar zagna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filament-breezy's Issues

No reset password link

Hi

My logon form does not show a "password reset link". The options in the breezy-config file haven't been changed. Any idea what I missed?

image

Overriding the register class route and it does not load

I am trying to use another fields for my registration form, like mobile instead of email.
I tried to override the class registration, creating a Register class in App\Http\Livewire\Auth and extending FilamentBreezyRegister.
I registered a route for the /register in web.php: Route::get('/register', App\Http\Livewire\Auth\Register::class). But the route doesn't work, instead it goes with the package default route and the default Register class.
If i load my Package ServiceProviders before the RoutingServiceProvider, i will be able to override the Package routes within my routes but i guess there should be a better way that I'm missing.

Sorry for the mess before, i mistook the packages name. Thanks for the awesome work you have done.

2FA bypass

We're setting up Filament with Breezy and want our admins to be able to use 2FA, so we've enabled it in the config. We've also configured admin panel access based on the email domain as described in the filament docs. Now if a user logs in via Filament it's all working fine. But if the user uses the login page of the app and then goes to Filament there is no 2FA prompt, completely bypassing it. Should we configure someting differently or is this a bug?

Sanctum tokens do not support custom PersonalAccessToken models

Using Sanctum, it's possible to define a custom model to use for personal access tokens. In the boot() method of a service provider, Laravel's docs note that you can do so like this:

Sanctum::usePersonalAccessTokenModel(\App\Models\CustomTokenModel::class);

However, this isn't respected by the Filament Breezy package, which is hard-coded to return a Laravel\Sanctum\PersonalAccessToken class. Instead, I think it should probably reference Laravel\Sanctum::$personalAccessTokenModel.

Thanks for a great package :)

v2 - Custom Component is duplicated in profile

Hello,

using

php artisan make:livewire MyCustomComponent

and registering it via method

BreezyCore::make()
->myProfileComponents([MyCustomComponent::class])

seems to show the livewire component twice in profile. The issue seems to be in file src/BreezyCore.php, method:

public function boot(Panel $panel): void
{
    if ($this->myProfile) {
        Livewire::component('personal_info', PersonalInfo::class);
        Livewire::component('update_password', UpdatePassword::class);
        $this->myProfileComponents(array_merge([    <----------- appends component
            'personal_info' => PersonalInfo::class,
            'update_password' => UpdatePassword::class
        ], $this->registeredMyProfileComponents)); 

and/or this method:

public function myProfileComponents(array $components)
{
    $this->registeredMyProfileComponents = [
        ...$this->registeredMyProfileComponents,
        ...$components,  
    ];

    return $this;
}

Basically method myProfileComponents gets called twice: once in AppProvider and BreezyCore

Version: v2.1.1

Overwrite PersonalInfo component and add extra field

I have created a class to overwrite the PersonalInfo component:

class PersonalInfo extends \Jeffgreco13\FilamentBreezy\Livewire\PersonalInfo
{
    public array $only = ['name','name_display', 'email'];

    public function getProfileFormSchema(): array
    {
        return [
            TextInput::make("name")
                ->columnSpanFull()
                ->label("Benutzername")
                ->hint("Änderbar nur durch Admins")
                ->disabled(fn(): bool => ! $this->user->hasRole([User::ROLE_SUPER_ADMIN, User::ROLE_ADMIN])),
            TextInput::make("name_display")
                ->label("Anzeigename")
                ->columnSpanFull()
                ->hint("zB. Vor- und Familienname"),
            TextInput::make("email")->unique(config('filament-breezy.user_model'), ignorable: $this->user)
                ->disabled(fn(): bool => ! $this->user->hasRole([User::ROLE_SUPER_ADMIN, User::ROLE_ADMIN]))
                ->hint("Änderbar nur durch Admins")
                ->columnSpanFull()
                ->label("E-Mail"),
        ];
    }
}

and registered it:

BreezyCore::make()
    ->myProfileComponents([
        'personal_info' => PersonalInfo::class
    ])

The field exists in the table:

image

But I cant update it. After save the field disapears. When I reload the page, the old value is show:

simplescreenrecorder-2023-08-12_16.52.51.mp4

Anybody added Spatie Welcome Notification?

Using the Issues here because Discussions are unavailable.

I am looking to add Spatie Welcome Notification package because I believe it makes sense to send an email to new users created by an admin to allow them to set their own password.

Here’s the package:
https://github.com/spatie/laravel-welcome-notification

Since this is my first Filament project (have already used plain Laravel and Backpack several times), any tips/guidance on how to do this are welcome!

[feature request] Require current password when changing password

(I tried to request a feature but got a 404, so I apologize for submitting this in this manner.)

Wouldn't it be more secure to require a user to submit their current password when changing their password?

That's my feature request: that the user must supply their current password when changing their password.

Hope that makes sense. 🤓

2 Factor Verification Not Working.

Even though I enter the code I get from the application on the application screen, it constantly says that the 6-digit code I get is incorrect. And I cannot make progress.
Screenshot_114

In roles page (for each role) takes too much time to modify permissions

Hi thanks for the good package you provide to community.
When i have many models like more than 10, In roles page (for each role) takes too much time to modify permissions. As i see in network request, the response for each modification takes a lot of resources and heavy in size (+600kb).
I'm not sure how to make it faster.

Route [password.reset] not defined.

After the last update for notifications, after you click SUBMIT on route /password/reset you get an error:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route [password.reset] not defined

Add CheckBoxList to register page

Hello,

I tried to add CheckBoxList to register page but it doesn't work, Livewire doesnt want to put data in array when class property is defined as array and if I define property as string, Livewire only keeps the last value.

Any idea?

CardPage not found

Hi,
I'm trying to install 2.x on fresh laravel 10 Filament 3, an error appears :

Error 

 Class "Filament\Pages\CardPage" not found

 at vendor/jeffgreco13/filament-breezy/src/Pages/TwoFactorPage.php:19
    15▕ use Filament\Http\Controllers\Auth\LogoutController;
    16▕ use Jeffgreco13\FilamentBreezy\Facades\FilamentBreezy;
    17▕ use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
    18▕ 
 ➜  19▕ class TwoFactorPage extends CardPage
    20▕ {
    21▕     use WithRateLimiting;
    22▕ 
    23▕     protected static string $view = 'filament-breezy::filament.pages.two-factor';

Thanks

Hyperlinks to registration page

In case I would like to add a hyperlink on a non-filament page to the registration page (e.g. on my landing page), this hyperlinks don't work. (<a href="/admin/register">Sign up</a>)

The hyperlink to the login page works well and then from there the navigation link to the registration also works fine. But not from outside of filament.

After I once go through the login page to the registration, it starts also work from the landing page. It feels like the registration page is not created on boot or something.

(registration url is also fine when typed in manually)

Feature request: add option to disable the confirm password input

Hey there! First of all, thanks for making such a great package!

I see that the password confirmation input is hard-coded in the Register.php form schema. There are a lot of criticism regarding a field like this. I think it would be really nice to have the configuration option to disable it. Maybe by using a ->when() method chain?

See uxmovement.com, ux.stackexchange.com, and about 377 000 000 more results on Google.

An additional feature that I think would be amazing that is useful both when there is a confirmation field and not is to have a way to show the password in plain text as is suggested in Sign-in form best practices at web.dev as this is great for both UX and accessibility.
image

Sidenote, on the issues page there are links to create discussions, however, the discussion page is not enabled.

Possible bug: 2FA QR code showing even after setup is complete

Description

I don't think the 2FA QR code and recovery code instructions should be shown once a user has completed 2FA setup. Additionally, I don't think the store_codes message should be shown either, especially not since it shows up in duplicate if one clicks on the button to show the recovery codes.

Expected result

Here's a screenshot of what I think the widget should look like once setup is complete.

[feature request] Password expiration feature

The current package lacks functionality that automatically expires passwords, which is crucial for enhancing the security of user accounts. I propose to address this by implementing a password expiration feature to enforce regular password updates and reduce the risk of unauthorized access. Password expiration is a widely accepted security practice that prompts users to change their passwords regularly, thereby minimizing the impact of compromised or weak passwords.

To overcome this limitation and encourage better security practices, I recommend implementing a password expiration function with the following features:

  • Introduce a configuration option to enable password expiration
  • Introduce a configuration option to specify the duration (in days) for password validity
  • Introduce a configuration option to enable password expiration notification (none, mail, database as an array of options)
  • Introduce a configuration option to specify the notification period (in days) for password expiration. This option will take an array of notification days to allow for multiple notifications to be sent.
  • Develop a notification mechanism to alert users when their password expiration date is approaching. The notification methods will support DB notifications and email.
  • Implement middleware that checks the users.updated_at field and redirects users to a password reset page when necessary.

If you are interested in contributing to the development of this feature or have any suggestions, please leave your comments on this issue.

TwoFactorPage SimplePage dont exist v2.0.0-beta2

Hi!
I am trying out Filament 3 and I installed your released version v2.0.0-beta2 which has been optimized for Filament 3.

Unfortunately this release seems to be buggy, because the SimplePage, that is used inside of

class TwoFactorPage extends SimplePage

is no longer supported since Filament 3.
It was different in your previous release Beta1 and now again in Beta2. What was the issue or was that a mistake?

Missing notification on forgotten password screen

Hi,

on route /admin/password/request after you submit your email, there is no notification that the email was sent and also the email stays in the form - probably should be cleared.

I think it has to do with the latest notification system update in filament.

Thanks for a nice package.

Email verify with id/hash route redirects without updating users table?

Hi. I suspect I'm doing something wrong, but I've installed this package as instructed, added MustVerifyEmail to the User role, updated the filament config to use the new Login class, and marked all of Filament as protected by EnsureEmailIsVerified middleware. When I try to login as an existing user I get the prompt to initiate a new verification email, the email arrives, and has the proper format (https://mysite.test/admin/email/verify/<user_id>/<hash>?expires=<timestamp>&signature=<signature>).

But when I click on that verify link, I'm just 302 redirected to /admin/login and the users table is not updated to reflect the verification.

I've verified that the full route exists as expected. Telescope says of the request:

Controller Action 
JeffGreco13\FilamentBreezy\Http\Controllers\EmailVerificationController@__invoke

Middleware 
Illuminate\Cookie\Middleware\EncryptCookies, Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse, Illuminate\Session\Middleware\StartSession, Illuminate\Session\Middleware\AuthenticateSession, Illuminate\View\Middleware\ShareErrorsFromSession, Illuminate\Foundation\Http\Middleware\VerifyCsrfToken, Illuminate\Routing\Middleware\SubstituteBindings, Filament\Http\Middleware\DispatchServingFilamentEvent, Filament\Http\Middleware\MirrorConfigToSubpackages, Filament\Http\Middleware\Authenticate, signed

Is there something else I need to do to make sure the User model is updated as verified?

Thank you.

Some strings are not translatable

Hello,

I'm implementing this package on my filament app, and found that some strings cannot be translated as they're not on the lang file. These are (that I know):

  • Account
  • My profile
  • Profile
  • Or sign in to your account
  • Check your inbox for instructions.
  • Error: please try again later.
  • Please wait before trying again.
  • User with this email not found.

I have been unable to translate using a json file as I usually do with "automated" filament strings (like menu links or page headers).

I'm willing to contribute a translation to spanish, would love to have all the strings translated.

Auto login when registering is not taking into account the auth guard selected

Hello!

I'm using on filament a different model (UserAdminPanel.php) than the basic one (User.php) that uses "session" instead of "jwt". When I register a person, it stores the user on DB correctly and tries automatically to make the login but it fails.

Then the normal login works with the created user, so I believe it's an error of abstraction on the plugin.

image

image

image

image

image

Thank you in advance!

Cannot cache config out of the box...

I noticed that one cannot cache the configuration out of the box because of the following:

    /*
    | Set an array that's compatible with the Filament Forms rules() method. You can also pass an instance of \Illuminate\Validation\Rules\Password::class. Rules for required and confirmed are already set. These rules will apply to the My Profile, registration, and password reset forms.
    */
    "password_rules" => [\Illuminate\Validation\Rules\Password::min(8)],

I receive the following error: Error::("Call to undefined method Illuminate\Validation\Rules\Password::__set_state()")

It may be that this is an issue with Password in that it's not serializable, but until/unless that's changed, perhaps a warning should be added to the comments or an alternative set of default rules should be provided.

Mismatched Trait Method

I'm getting this error when running composer update:

Access level to JeffGreco13\FilamentBreezy\Traits\HasBreezyTwoFactor::getCachedAction() must be public (as in class Filament\Pages\Page)

at vendor/jeffgreco13/filament-breezy/src/Traits/HasBreezyTwoFactor.php:92
     8889return $actions;
     90▕     }
     91▕
  ➜  92protected function getCachedAction(string $name): ?Action
     93▕     {
     94return $this->getCachedActions(false)[$name] ?? null;
     95▕     }
     96

Looks like Filament might have updated their methods in the Page class.

Custom profile gets no values

I followed your instructions "Create custom My Profile components" and used it to overwrite the 'personal_info' section:

class MyProfileComponent extends \Jeffgreco13\FilamentBreezy\Livewire\MyProfileComponent
{
    protected string $view = "livewire.admin.my-profile-component";
    public array $data;


    public function form(Form $form): Form
    {
        return $form
            ->schema([
                Placeholder::make("test")
                    ->content(fn($record) => json_encode($record)),
                TextInput::make("name")
                    ->hint("Changable just by Admins")
                    ->disabled(fn(): bool => !auth()->user()->hasRole([User::ROLE_SUPER_ADMIN, User::ROLE_ADMIN]))
            ])
            ->statePath('data');
    }
}

This gives me the following:

image

As you can see, I can't access any data and the name field is empty, which is wrong.

Similar code worked in V1. I updated to v2.1.3.

Possible Bug: User avatar doesn't show in navbar - v3

I'm a new Filament user, and I'm trying out V3. I've installed everything correctly as a new project, but I've noticed a few things.

Once an avatar has successfully uploaded and is stored in the database, it doesn't show in the menu bar (where the user's initials would originally be). The code for a background-image is there, but it seems to be loading without the storage prefix.

Is there some steps that I'm missing?

Screenshot 2023-08-02 at 11 46 12 Screenshot 2023-08-02 at 11 46 20 Screenshot 2023-08-02 at 11 53 04

And then when I add /storage/ in dev tools:

Screenshot 2023-08-02 at 11 53 21 Screenshot 2023-08-02 at 11 53 25

Profile page is not working when working with Tenancy

Hello,

I hope this message finds you well. I am writing to report an issue related to the usage of Filament v3 and Breezy v2 in our project. It has come to our attention that when the panel incorporates Tenancy, the my-profile page fails to function as expected. This is because the application expects a tenant id.

Steps to Reproduce:

  1. Install Filament v3 and Breezy v2 in the project.
  2. Configure the panel to include Tenancy.
  3. Navigate to the my-profile page.

Expected Behavior:
The my-profile page should function correctly, regardless of the Tenancy configuration.

Actual Behavior:
Upon accessing the my-profile page with Tenancy enabled, the page does not work as intended, leading to an error.

Screenshot:
Scherm­afbeelding 2023-07-21 om 23 21 50

Best regards,
Tygo Egmond

Break up profile form into separate components

Hello,

more of a question really. Wouldn't it make sense to split up the profile form into separate components? That way we could just use these components if we want to add sections to the profile. Right now we have to publish the whole profile template. This also means that any changes that happen in the future have to be manually re-added to the published template.

Cheers!

Unable to access login, register or reset password routes

I am unable to access register, login or reset password. I am using nginx server. All other frontend pages works perfectly fine but unable to access login, register and password reset page.
Routes:
mydomain.com/admin/login
mydomain.com/admin/register
mydomain.com/admin/password/reset

It is giving me 404 Not Found (nginx error).

image

When using usernames, profile attempts to update email

I've set login_fallback_field in the config to 'username'

Login works as expected.

On the Profile page, the second field is hardcoded to 'email' rather than obeying the login field config setting.

protected function getUpdateProfileFormSchema(): array
    {
        return [
            Forms\Components\TextInput::make("name")
                ->label(__('filament-breezy::default.fields.name')),
            Forms\Components\TextInput::make("email")->unique(ignorable: $this->user)
                ->label(__('filament-breezy::default.fields.email')),
        ];
    }

Should this not follow the fallback_login_field setting in the config?

Happy to submit a PR.

config and route cache error after installing breezy

After installing breezy, when i deploy to production, i have been getting the following errors when running the caching commands

artisan config:cache
Your configuration files are not serializable.

artisan route:cache
Unable to prepare route [password/reset] for serialization. Another route has already been assigned name [password.request].

Replace strtolower by lcfirst in order to correctly translate case-sensitive languages

strtolower is used in the following views:

  • register.blade.php
  • login.blade.php
  • reset-password.blade.php

This prevents the correct translation of case-sensitive languages (namely German).

By removing strtolower, we'd end up with a text like "Oder Erstellen Sie ein Konto". That means, the E in Erstellen is capitalized because it comes from another heading (that correctly is capitalized). The E in German should be lower case.

One alternative that might avoid breakages and would work in German as well is to lower case only the first character with lcfirst. We'd then have "Oder erstellen Sie ein Konto", which is correct (that's what I do locally).

Suggestion: replace strtolower by lcfirst on the templates above.

Force 2FA

Hi there,

I am starting to use the filament breezy implementation in a new project.
I need the users to force setting up an 2FA, so no opt-in.

I found out in your Login component how to do this, except I am not sure how to then force the user to generate the code. I don't see the possibility to generate the QR code. This is only possible on the profile page?

How to do this right after login?

Pull request #116 breaks email verification

The pull request #116 that was merged breaks email verification because it added the __construct method which added authentication middleware but the middleware was not namespaced correctly and breaks as it is looking for JeffGreco13\FilamentBreezy\Http\Controllers\Authenticate class. Should be Filament\Http\Middleware\Authenticate::class.

Error in views after split profile

Issue create because #125

production.ERROR: Undefined variable $plain_text_token 
{"view":{"view":"/home/**/public_html/vendor/jeffgreco13/filament-breezy/resources/views/components/sections/sanctum.blade.php","data":[]},"userId":1,"exception":"[object] (Spatie\LaravelIgnition\Exceptions\ViewException(code: 0): 
Undefined variable $plain_text_token at /home/**/public_html/vendor/jeffgreco13/filament-breezy/src/../resources/views/components/sections/sanctum.blade.php:16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.