Identity login uses PasswordSignInAsync with Input.Email as username so username and email of account need to be the same
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
https://github.com/dotnet/aspnetcore/blob/afeab33afa4d81d3799dd665d6c1f47618815791/src/Identity/UI/src/Areas/Identity/Pages/V5/Account/Login.cshtml.cs#L130
This line above uses the Input.Email for logging in, but the PasswordSignInAsync method expects a username, therefore can not login if the username differs from the email..
### Expected Behavior
After using the libraries with default configuration one should be able to login without scaffolding Login.cshtml.cs because this call is used wrongly..
### Steps To Reproduce
+ Use libraries with default configuration
+ Add users with username and email (example user: foo, email: foo@test.com)
*Outcome in usertable: username = foo, NormalizedUsername = FOO, email = foo@test.com, NormalizedEmail = FOO@TEST.COM*
+ Try to login with email
### Exceptions (if any)
_No response_
### .NET Version
6
### Anything else?
Possible solutions are (in my opinion, maybe I miss something)
+ Edit PasswordSignInAsync to allow an email as first parameter
+ Edit PasswordSignInAsync to find user by email or by username
+ Use UserManager to select the user by email and pass it to PasswordSignInAsync correctly
Since this would be a small change (at least as far as I can see), I would volunteer to provide a PR, but I need to know which solution would be appreciated ;)
Also I do not know what DotnetVersion I should provide (I am currently using 6 but this bug might affect versions below too)
Have a nice day :D
Contributor guide
Assessment
This issue has not been assessed yet.