private static void OnPagePreRenderCompleteEventHandler(IPagePreRenderCompleteEvent e) { if (e.PageSiteNode.IsBackend) { return; } // run any gigya related code that needs to be done for every request GigyaAccountHelper.ProcessRequestChecks(HttpContext.Current); }
public virtual ActionResult Index() { if (SystemManager.IsDesignMode || SystemManager.IsPreviewMode) { return(new EmptyResult()); } var settings = _settingsHelper.GetForCurrentSite(true); if (!settings.EnableRaas) { if (settings.DebugMode) { _logger.Debug("RaaS disabled so GigyaSettings not added to page."); } return(new EmptyResult()); } if (string.IsNullOrEmpty(settings.ApiKey)) { _logger.Error("Gigya API key not specified. Check settings on Administration -> Settings -> Gigya"); return(new EmptyResult()); } // check if Sitefinity is the session leader and sign in if required GigyaAccountHelper.ProcessRequestChecks(System.Web.HttpContext.Current, settings); var identity = ClaimsManager.GetCurrentIdentity(); var currentIdentity = new CurrentIdentity { IsAuthenticated = identity.IsAuthenticated, Name = identity.Name }; var viewModel = _settingsHelper.ViewModel(settings, Url, currentIdentity); viewModel.ErrorMessage = Res.Get(Constants.Resources.ClassId, Constants.Resources.ErrorMessage); Page pageHandler = HttpHandlerExtensions.GetPageHandler(HttpContext.CurrentHandler); // check if the widget is being rendered through Sitefinity or directly from the Razor view viewModel.RenderScript = pageHandler == null || pageHandler.Header == null || pageHandler.Header.Controls == null; if (!viewModel.RenderScript) { var script = this.GetScript(viewModel); pageHandler.Header.Controls.Add((Control) new LiteralControl(script)); } var viewPath = FileHelper.GetPath("~/Mvc/Views/GigyaSettings/Index.cshtml", ModuleClass.ModuleVirtualPath + "Gigya.Module.Mvc.Views.GigyaSettings.Index.cshtml"); return(View(viewPath, viewModel)); }
private void Context_BeginRequest(object sender, EventArgs e) { var context = HttpContext.Current; var request = new HttpRequestWrapper(context.Request); if (!request.IsAjaxRequest()) { // currently we only care about ajax requests since full page loads will go through the normal CMS pipeline return; } GigyaAccountHelper.ProcessRequestChecks(context); }
// GET: LoginStatus public ActionResult Index() { var currentIdentity = ClaimsManager.GetCurrentIdentity(); if (!currentIdentity.IsAuthenticated) { return(new EmptyResult()); } // check if Sitefinity is the session leader and sign in if required GigyaAccountHelper.ProcessRequestChecks(System.Web.HttpContext.Current); var viewPath = FileHelper.GetPath("~/Mvc/Views/GigyaLogout/Index.cshtml", ModuleClass.ModuleVirtualPath + "Gigya.Module.Mvc.Views.GigyaLogout.Index.cshtml"); var model = new GigyaLogoutViewModel { Label = StringHelper.FirstNotNullOrEmpty(Label, "Logout"), LoggedOutUrl = SitefinityUtils.GetPageUrl(LogoutPageId) }; return(View(viewPath, model)); }
public virtual ActionResult Index() { var decryptApplicationSecret = false; var settings = _settingsHelper.GetForCurrentSite(decryptApplicationSecret); if (!settings.EnableRaas) { if (settings.DebugMode) { _logger.Debug("RaaS disabled so GigyaSettings not added to page."); } return(new EmptyResult()); } if (string.IsNullOrEmpty(settings.ApiKey)) { _logger.Error("Gigya API key not specified. Umbraco -> Gigya"); return(new EmptyResult()); } var accountHelper = new GigyaAccountHelper(_settingsHelper, _logger, _membershipHelper); accountHelper.LoginToGigyaIfRequired(); var currentIdentity = new CurrentIdentity { IsAuthenticated = User.Identity.IsAuthenticated, Name = User.Identity.Name }; var viewModel = _settingsHelper.ViewModel(settings, Url, currentIdentity); // umbraco doesn't use web forms so the script will always be rendered inline viewModel.RenderScript = true; var viewPath = "~/Views/GigyaSettings/Index.cshtml"; return(View(viewPath, viewModel)); }
// GET: LoginStatus public ActionResult Index() { var currentIdentity = ClaimsManager.GetCurrentIdentity(); if (currentIdentity.IsAuthenticated) { // check if Sitefinity is the session leader and sign in if required GigyaAccountHelper.ProcessRequestChecks(System.Web.HttpContext.Current); return(new EmptyResult()); } if (RenderMethod != Constants.Resources.Designer.EmbeddedScreen) { GenerateContainer = false; ContainerId = null; } var viewPath = FileHelper.GetPath("~/Mvc/Views/GigyaLogin/Index.cshtml", ModuleClass.ModuleVirtualPath + "Gigya.Module.Mvc.Views.GigyaLogin.Index.cshtml"); var model = new GigyaLoginViewModel { Label = StringHelper.FirstNotNullOrEmpty(Label, "Login"), ContainerId = ContainerId, GeneratedContainerId = string.Concat("gigya-container-", Guid.NewGuid()), MobileScreenSet = MobileScreenSet, ScreenSet = StringHelper.FirstNotNullOrEmpty(ScreenSet, "Default-RegistrationLogin"), StartScreen = StartScreen, LoggedInUrl = SitefinityUtils.GetPageUrl(LoggedInPage) }; if (RenderMethod == Constants.Resources.Designer.EmbeddedScreen && (GenerateContainer || string.IsNullOrEmpty(model.ContainerId))) { model.ContainerId = model.GeneratedContainerId; } return(View(viewPath, model)); }
protected virtual GigyaLoginStatusViewModel GetViewModel(ClaimsIdentityProxy currentIdentity) { var model = new GigyaLoginStatusViewModel { SiteId = SystemManager.CurrentContext.IsMultisiteMode ? SystemManager.CurrentContext.CurrentSite.Id : Guid.Empty, IsLoggedIn = currentIdentity.IsAuthenticated, IsDesignMode = SystemManager.IsDesignMode }; if (model.IsLoggedIn) { // check if Sitefinity is the session leader and sign in if required GigyaAccountHelper.ProcessRequestChecks(System.Web.HttpContext.Current); var userManager = UserManager.GetManager(); var currentUser = userManager.GetUser(currentIdentity.UserId); if (currentUser != null) { model.Email = currentUser.Email; var profileManager = UserProfileManager.GetManager(); var profile = profileManager.GetUserProfile <SitefinityProfile>(currentUser); if (profile != null) { model.FirstName = profile.FirstName; model.LastName = profile.LastName; } } else { model.IsLoggedIn = false; } } return(model); }