public async Task <IActionResult> OnGet(string returnUrl = null) { if (!_options.Pages.IsRegisteringEnabled) { return(NotFound("Deze pagina is niet beschikbaar.")); } Input = new InputModel { Languages = new List <PickedLanguageDto> { new PickedLanguageDto { ShortLanguage = "NL", LongLanguage = "Nederlands" }, new PickedLanguageDto { ShortLanguage = "EN", LongLanguage = "English" }, new PickedLanguageDto { ShortLanguage = "FR", LongLanguage = "Français" }, new PickedLanguageDto { ShortLanguage = "DE", LongLanguage = "Deutsch" }, } }; TxtSelectLanguage = await TranslationsService.TranslateAsync("Select a language."); ExternalLogins = (await _signInService.GetExternalAuthenticationSchemesAsync()).ToList(); ReturnUrl = returnUrl; IsAuthenticationViaExternalServicesEnabled = _options.User.CanUseExternalAuthenticationServices; return(Page()); }
public async Task OnGetAsync(string returnUrl = null) { if (!string.IsNullOrEmpty(ErrorMessage)) { ModelState.AddModelError(string.Empty, ErrorMessage); } returnUrl = returnUrl ?? Url.Content("~/"); // Clear the existing external cookie to ensure a clean login process await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme); ExternalLogins = (await signInService.GetExternalAuthenticationSchemesAsync()).ToList(); ReturnUrl = returnUrl; }
public async Task <IActionResult> OnGetAsync(string returnUrl = null) { if (!_options.Pages.IsLoginInEnabled) { return(NotFound()); } returnUrl ??= Url.Content("~/"); // Clear the existing external cookie to ensure a clean login process await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme); ExternalLogins = (await _signInService.GetExternalAuthenticationSchemesAsync()).ToList(); IsAuthenticationViaExternalServicesEnabled = _options.User.CanUseExternalAuthenticationServices; ReturnUrl = returnUrl; return(Page()); }
public async Task <IActionResult> ExternalLogins() { var user = await _userManager.GetUserAsync(User); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } var logins = await _userManager.GetLoginsAsync(user); var model = new ExternalLoginsViewModel { CurrentLogins = await _userManager.GetLoginsAsync(user) }; model.OtherLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()) .Where(auth => model.CurrentLogins.All(ul => auth.Name != ul.LoginProvider)) .ToList(); model.ShowRemoveButton = await _userManager.HasPasswordAsync(user) || model.CurrentLogins.Count > 1; model.StatusMessage = StatusMessage; return(View(model)); }