Andy T
Andy T

Reputation: 1377

Non Unique Username with ASP.Net Identity 2.0

I have a situation where my username is not unique. Email is used as username and one email can have many different passwords in the database and all are legitimate. How do I use ASP.NET Identity 2.0 in this situation.

var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout: false);

Above line expects only one user in the database. If the multiple records are returned - it returns failure. That is exactly what is expected it to do but this logic doesn't work for me.

How do I override this logic?

Alternatively, I am ready to customize this login but the problem is - I am not sure what all things are done as a part of PasswordSignInAsync. Like adding to cookies etc. Please help.

Upvotes: 0

Views: 730

Answers (1)

Andy T
Andy T

Reputation: 1377

I made it work. I had to use Username + password combination as a unique Username.
These are different situations in industry for different types of needs.

Upvotes: 1

Related Questions