c# - ASP.NET OWIN use Email to Login (instead of username) -
currently, application owin authentication following way (using username & password, in code below). need make users log in using email (instead of username) , password.
as workaround, can find username email (entered user) , use current method (username + password), double database call, i'm trying avoid. please advise. thanks!
protected void login(object sender, eventargs e) { if (isvalid) { var manager = new myusermanager(new myuserstore(new mydbcontext())); myuser user = manager.find(username.text, password.text); if (user != null) { identityhelper.signin(manager, user, rememberme.checked); identityhelper.redirecttoreturnurl(request.querystring["returnurl"], response); } else { failuretext.text = "invalid login"; errormessage.visible = true; } } }