public async Task <ActionResult> SaveAndSearch(string returnUrl) { var userId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName); if (string.IsNullOrWhiteSpace(userId)) { _logger.Warn($"UserId not found on OwinWrapper. Redirecting back to passed in returnUrl: {returnUrl}"); return(Redirect(returnUrl)); } await OwinWrapper.UpdateClaims(); var userRef = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName); var email = OwinWrapper.GetClaimValue(ControllerConstants.EmailClaimKeyName); var firstName = OwinWrapper.GetClaimValue(DasClaimTypes.GivenName); var lastName = OwinWrapper.GetClaimValue(DasClaimTypes.FamilyName); await _homeOrchestrator.SaveUpdatedIdentityAttributes(userRef, email, firstName, lastName); _returnUrlCookieStorageService.Create(new ReturnUrlModel { Value = returnUrl }, ReturnUrlCookieName); return(RedirectToAction(ControllerConstants.GetApprenticeshipFundingActionName, ControllerConstants.EmployerAccountControllerName)); }
public async Task <ActionResult> Index() { var userId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName); if (!string.IsNullOrWhiteSpace(userId)) { await OwinWrapper.UpdateClaims(); var partialLogin = OwinWrapper.GetClaimValue(DasClaimTypes.RequiresVerification); if (partialLogin.Equals("true", StringComparison.CurrentCultureIgnoreCase)) { return(Redirect(ConfigurationFactory.Current.Get().AccountActivationUrl)); } var accounts = await _homeOrchestrator.GetUserAccounts(userId); if (accounts.Data.Invitations > 0) { return(RedirectToAction(ControllerConstants.InvitationIndexName, ControllerConstants.InvitationControllerName, new { })); } if (accounts.Data.Accounts.AccountList.Count == 1) { var account = accounts.Data.Accounts.AccountList.FirstOrDefault(); return(RedirectToAction(ControllerConstants.IndexActionName, ControllerConstants.EmployerTeamControllerName, new { HashedAccountId = account.HashedId })); } var flashMessage = GetFlashMessageViewModelFromCookie(); if (flashMessage != null) { accounts.FlashMessage = flashMessage; } if (accounts.Data.Accounts.AccountList.Count > 1) { return(View(accounts)); } return(View(ControllerConstants.SetupAccountViewName, accounts)); } var model = new { HideHeaderSignInLink = true }; return(View(ControllerConstants.ServiceStartPageViewName, model)); }
public async Task <ActionResult> HandleNewRegistration(string correlationId = null) { await OwinWrapper.UpdateClaims(); if (!string.IsNullOrWhiteSpace(correlationId)) { var userRef = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName); var email = OwinWrapper.GetClaimValue(ControllerConstants.EmailClaimKeyName); var firstName = OwinWrapper.GetClaimValue(DasClaimTypes.GivenName); var lastName = OwinWrapper.GetClaimValue(DasClaimTypes.FamilyName); await _homeOrchestrator.SaveUpdatedIdentityAttributes(userRef, email, firstName, lastName, correlationId); } return(RedirectToAction(ControllerConstants.IndexActionName)); }
public async Task <ActionResult> HandleEmailChanged(bool userCancelled = false) { if (!userCancelled) { var flashMessage = new FlashMessageViewModel { Severity = FlashMessageSeverityLevel.Success, Headline = "You've changed your email" }; AddFlashMessageToCookie(flashMessage); await OwinWrapper.UpdateClaims(); var userRef = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName); var email = OwinWrapper.GetClaimValue(ControllerConstants.EmailClaimKeyName); var firstName = OwinWrapper.GetClaimValue(DasClaimTypes.GivenName); var lastName = OwinWrapper.GetClaimValue(DasClaimTypes.FamilyName); await _homeOrchestrator.SaveUpdatedIdentityAttributes(userRef, email, firstName, lastName); } return(RedirectToAction(ControllerConstants.IndexActionName)); }
public async Task <ActionResult> HandleNewRegistration() { await OwinWrapper.UpdateClaims(); return(RedirectToAction(ControllerConstants.IndexActionName)); }