F
Filamentβ€’17mo 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'),
]);
}
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...! πŸ‘
1 Reply
Patrick Boivin
Patrick Boivinβ€’17mo ago
Hey! I'm not a maintainer so just my personal opinion β€” I think this is a good idea and if you can figure out a good API for this instead of overrides, I think you should PR it πŸ™‚
Want results from more Discord servers?
Add your server