FilamentF
Filamentβ€’3y ago
Travis

Login::authenticate() inject credentials...?

Hi,

First of all, I'm enjoying the v3 beta so far. Thx. πŸ€“

I have extended the default Login because we have a use-case where we need to log in using a username and password. We make changes to the form, but then we override the authenticate() method...copying/pasting the whole thing and then changing 'email' to 'username'.

Is there a better way to do this...?

Would it be worthwhile to submit a PR to allow for one to inject credentials and/or somehow allow for a custom version of the following code?
        if (! Filament::auth()->attempt([
            'username' => $data['username'],
            'password' => $data['password'],
        ], $data['remember'])) {
            throw ValidationException::withMessages([
                'data.username' => __('filament::pages/auth/login.messages.failed'),
            ]);
        }


Thanks again...! πŸ‘
Was this page helpful?