You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an application in Database-First mode and unfortunately, the database structure doesn't follow Laravel conventions so a lot of things have to be customised.
When customising the Fortify settings, I changed username to <my_database_username_column> and kept email to email to match the form email field in config/fortify.php but it turns out that the request validator uses the username instead of the email and so the changes to the configuration file don't produce the expected changes. According to the documentation for the username() and email() methods in src/Fortify.php, email() retrieves the name of the email/username field in the request and username(), the name of the field for authentication in the database. Digging around in the source code, I noticed that only the username() method is used (whether for the request field or the database field).
Steps To Reproduce
create a fresh Laravel project with Jetstream and Inertia
change the default user model to a custom one (different column name, different implementation of the Authenticatable interface)
add a custom user provider for authentication and register it in the AuthServiceProvider
update auth config file to use the custom user provider by default
change the value of username to a custom one in fortify config file
run the app and attempt to login : Request validation fails : custom_email_column: "The custom email column field is required."
When I attempt to login using your repo I don't get any exception message. I don't have any users in the database.
I don't immediately understand why there's no error message. Could you please add a test user to the DatabaseSeeder.php for me to run so I can try a real scenario?
I think you're confusing fortify and jetstream here. The option you modified does perfectly work with Fortify but you still need to adjust your Jetstream code to accommodate for it. Mainly the Login.vue file etc. If you need help with that please try a support channel:
Sure not. I tried replacing occurrences of Fortify::username() with Fortify::email() in src/Actions/AttemptToAuthenticate.php from Fortify's vendor files and it worked
Fortify Version
1.19.1
Laravel Version
10.39.0
PHP Version
8.1.18
Database Driver & Version
Oracle 19.0.0
Description
I'm working on an application in Database-First mode and unfortunately, the database structure doesn't follow Laravel conventions so a lot of things have to be customised.
When customising the Fortify settings, I changed
username
to<my_database_username_column>
and keptemail
toemail
to match the form email field inconfig/fortify.php
but it turns out that the request validator uses theusername
instead of theemail
and so the changes to the configuration file don't produce the expected changes. According to the documentation for theusername()
andemail()
methods insrc/Fortify.php
,email()
retrieves the name of the email/username field in the request andusername()
, the name of the field for authentication in the database. Digging around in the source code, I noticed that only theusername()
method is used (whether for the request field or the database field).Steps To Reproduce
Authenticatable
interface)username
to a custom one in fortify config filecustom_email_column: "The custom email column field is required."
Example repo: https://github.com/nightwalkeryao/bug-report/
The text was updated successfully, but these errors were encountered: