コード例 #1
0
        public async Task <IActionResult> OnGetCallbackAsync(string returnUrl = null)
        {
            switch (await _signInManager.EndSignInAsync(HttpContext, true))
            {
            case SignInStatus.Success:
                if (returnUrl != null)
                {
                    return(LocalRedirect(returnUrl));
                }

                return(RedirectToPage("/Index"));

            case SignInStatus.NoExternalCookie:
                break;

            case SignInStatus.InvalidUser:
                ModelState.AddModelError(string.Empty, "Not a valid user. A valid DCCN account is required.");
                break;

            case SignInStatus.InvalidStatus:
                ModelState.AddModelError(string.Empty, "Your account has not yet been fully activated. Please make sure you finish the check-in procedure. For more information you can contact DCCN/CNS administration.");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(Page());
        }