public Task <TUser> FindByEmailAsync(string email) { if (String.IsNullOrEmpty(email)) { throw new ArgumentNullException("email"); } TUser result = personLogic.GetByEmail(email) as TUser; if (result != null) { return(Task.FromResult <TUser>(result)); } return(Task.FromResult <TUser>(null)); }
public override Task <SignInStatus> PasswordSignInAsync(string userName, string password, bool isPersistent, bool shouldLockout) { string user = userName; BusinessLogicLayer.Components.Persons.PersonLogic personLogic = new BusinessLogicLayer.Components.Persons.PersonLogic(); BusinessLogicLayer.Entity.Persons.Person person = personLogic.GetByUserName(userName); if (person == null) { person = personLogic.GetByEmail(userName); } if (person != null) { user = person.UserName; } if (person != null) { if (!person.IsActive) { return(Task.FromResult(SignInStatus.LockedOut)); } } return(base.PasswordSignInAsync(user, password, isPersistent, shouldLockout)); }