Created
January 29, 2016 02:28
-
-
Save jasongaylord/813e8afe0d2c165b4c7c to your computer and use it in GitHub Desktop.
A partial IdentityConfig.cs snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationSignInManager : SignInManager<ApplicationUser, string> | |
{ | |
public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager) | |
: base(userManager, authenticationManager) | |
{ } | |
public override Task SignInAsync(ApplicationUser user, bool isPersistent, bool rememberBrowser) | |
{ | |
if (!user.EmailConfirmed) | |
{ | |
return Task.Factory.StartNew(() => { return SignInStatus.RequiresVerification; }); | |
} | |
return base.SignInAsync(user, isPersistent, rememberBrowser); | |
} | |
public override Task<ClaimsIdentity> CreateUserIdentityAsync(ApplicationUser user) | |
{ | |
return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager); | |
} | |
public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context) | |
{ | |
return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment