Create IUSerIdentityResult to show custom login errors to user#7734
Conversation
…t always show the same error for different situations
| @@ -60,7 +60,7 @@ private XRpcStruct MetaWeblogNewMediaObject( | |||
| UrlHelper url) { | |||
|
|
|||
| var user = _membershipService.ValidateUser(userName, password); | |||
There was a problem hiding this comment.
Whenever you call ValidateUser, use a new variable, for instance validationResult, then keep the user variable to be validationResult.User. This will prevent all the user.User changes.
|
I have just one concern with this change, it's that it allows for username checks. We can guess if an email is registered or not with this kind of information. |
|
@jardg, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
…ser or invalid password/user
|
This wont allow for username checks. Whether user is null or the combination user/password is invalid always returns The username or e-mail or password provided is incorrect. It was just I made a change returning an incorrect message from "The username or e-mail or password provided is incorrect." to "Invalid password". |
|
With "The username or e-mail or password provided is incorrect." you don't know if the user exists. With your message you know it exists. Create a new ASP.NET MVC application (dotnet core or not) then try to log with a non-existent user or with a wrong password (existing user). Compare the messages. |
|
I explained bad myself. In the first pull the message told you that the password was incorrect as you say. But I updated the pull request to correct this. With the changes the message "The username or e-mail or password provided is incorrect." is always displayed wether the user doesn't exist or the password is incorrect. So its safe in this concern. The messages included on the pull "You must verify your email" or "You must be approved before being able to login" are only displayed if the password/user validation done before is correct but the username didn't verify the mail or the user isn't approved yet. Otherwise it will show "The username or e-mail or password provided is incorrect.". I have tested these cases to work as expected. |
|
Two requests:
|
|
Changed to return List of LocalizedString as it can output one or more errors. Changed to output these messages. |
This way when a login isn't allowed We don't always display the same error for a invalid login.
The issue related is #7588