protected virtual bool SkipProcessor(LoggedInArgs args) { User user = User.FromName(args.Username, true); string existing = Registry.GetString(ScConstants.RegistryKeys.EditAllVersions); return(user == null && string.IsNullOrEmpty(existing)); }
public override void Process(LoggedInArgs args) { if (SkipProcessor(args)) { return; } Registry.SetString(ScConstants.RegistryKeys.EditAllVersions, ScConstants.Registry.CheckboxTickedRegistryValue); }
public override void Process(LoggedInArgs args) { Assert.ArgumentNotNull(args, "args"); if (!Uri.IsWellFormedUriString(args.StartUrl, UriKind.Relative) && IsAllowedBot(args.StartUrl)) { args.AbortPipeline(); } }
private static string PopulateSecurityrMessage(Publication publication, LoggedInArgs user, string action) { var message = string.Empty; if (!string.IsNullOrEmpty(publication.Message)) { message = publication.Message + "\n"; } message += $"User {action}\n" + $"User: {user.Username}\n"; return message; }
private static string PopulateSecurityrMessage(Publication publication, LoggedInArgs user, string action) { var message = string.Empty; if (!string.IsNullOrEmpty(publication.Message)) { message = publication.Message + "\n"; } message += $"User {action}\n" + $"User: {user.Username}\n"; return(message); }
public override void Process(LoggedInArgs args) { Sitecore.Diagnostics.Log.Info("Started LoginRedirect", " LoginRedirect "); if (Sitecore.Context.GetSiteName() != "login") { return; } string url = HttpUtility.UrlDecode( WebUtil.GetQueryString("url", "") ); if (!string.IsNullOrWhiteSpace(url)) { WebUtil.Redirect(url); } Sitecore.Diagnostics.Log.Info("Ended LoginRedirect", " LoginRedirect"); }
public void Process(LoggedInArgs args) { var settingsItem = Constants.SettingsItem; //Get excluded roles array var excludedRoles = settingsItem[Templates.DeploymentMode.Fields.LockOutUsers.ExcludedRoles].Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); //Check if current user is part of excluded list var isInExcludedRole = excludedRoles.Any(a => ((User)User.FromName(args.Username, AccountType.User)).IsInRole(a)); //Check if current user is Administrator var isAdmin = (User.FromName(args.Username, AccountType.User) as User).IsAdministrator; if (settingsItem[Templates.DeploymentMode.Fields.DeploymentModeOn].ToString().Equals("1") && settingsItem[Templates.DeploymentMode.Fields.LockOutUsers.LockOutUsersOn].ToString().Equals("1") && isAdmin == false && isInExcludedRole == false) { throw new ApplicationException("Not allowed. Your Admin has prevented logging in during deployment"); } }
/// <summary> /// </summary> protected virtual void LoggedIn() { User user = Sitecore.Security.Accounts.User.FromName(this.fullUserName, false); State.Client.UsesBrowserWindows = true; LoggedInArgs loggedInArg = new LoggedInArgs() { Username = this.fullUserName, StartUrl = this.startUrl }; LoggedInArgs loggedInArg1 = loggedInArg; Pipeline.Start("loggedin", loggedInArg1); this.startUrl = loggedInArg1.StartUrl + "&code=" + tokenService.TokenEncoder(user.Name, new TimeSpan(0, 0, 5)); using (UserSwitcher userSwitcher = new UserSwitcher(user)) { Log.Audit(this, "Bot-auth", new string[0]); } }
public override void Process(LoggedInArgs args) { Event.RaiseEvent("security:loggedIn", new object[] { }); }