Example #1
0
 public virtual async Task <bool> CanSignInAsync(TUser user)
 {
     if (Options.SignIn.RequireConfirmedEmail && !(await UserManager.IsEmailConfirmedAsync(user)))
     {
         Logger.LogWarning(LoggerEventIds.UserCannotSignInWithoutConfirmedEmail, "User cannot sign in without a confirmed email!");
         return(false);
     }
     if (Options.SignIn.RequireConfirmedAccount && !(await _confirmation.IsConfirmedAsync(UserManager, user)))
     {
         Logger.LogWarning(LoggerEventIds.UserCannotSignInWithoutConfirmedAccount, "User cannot sign in without a confirmed account!");
         return(false);
     }
     return(true);
 }
Example #2
0
 public virtual async Task <bool> CanSignInAsync(TUser user)
 {
     if (Options.SignIn.RequireConfirmedEmail && !(await UserManager.IsEmailConfirmedAsync(user)))
     {
         Logger.LogWarning(0, "User cannot sign in without a confirmed email.");
         return(false);
     }
     if (Options.SignIn.RequireConfirmedPhoneNumber && !(await UserManager.IsPhoneNumberConfirmedAsync(user)))
     {
         Logger.LogWarning(1, "User cannot sign in without a confirmed phone number.");
         return(false);
     }
     if (Options.SignIn.RequireConfirmedAccount && !(await _confirmation.IsConfirmedAsync(UserManager, user)))
     {
         Logger.LogWarning(4, "User cannot sign in without a confirmed account.");
         return(false);
     }
     return(true);
 }