public void AuthorizeRequest(object sender, EventArgs e) { if (!SystemSetupFacade.IsSystemFirstTimeInitialized) { return; } HttpApplication application = (HttpApplication)sender; HttpContext context = application.Context; bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context); if (adminRootRequest && UserValidationFacade.IsLoggedIn()) { _dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo); if (!_consoleArtifactsInitialized) { lock (_consoleArtifactsInitializeLock) { if (!_consoleArtifactsInitialized && !SystemSetupFacade.SetupIsRunning) { HookingFacade.EnsureInitialization(); FlowControllerFacade.Initialize(); ConsoleFacade.Initialize(); ElementProviderLoader.LoadAllProviders(); _consoleArtifactsInitialized = true; } } } } }
/// <summary> /// Appends the c1 meta tags to the head section. Those tag are used later on by SEO assistant. /// </summary> /// <param name="page">The page.</param> /// <param name="xhtmlDocument">The XHTML document.</param> public static void AppendC1MetaTags(IPage page, XhtmlDocument xhtmlDocument) { if (UserValidationFacade.IsLoggedIn()) { bool emitMenuTitleMetaTag = string.IsNullOrEmpty(page.MenuTitle) == false; bool emitUrlTitleMetaTag = string.IsNullOrEmpty(page.UrlTitle) == false; if (emitMenuTitleMetaTag || emitUrlTitleMetaTag) { xhtmlDocument.Head.Add( new XComment("The C1.* meta tags are only emitted when you are logged in"), new XElement(Namespaces.Xhtml + "link", new XAttribute("rel", "schema.C1"), new XAttribute("href", "http://www.composite.net/ns/c1/seoassistant"))); if (emitMenuTitleMetaTag) { xhtmlDocument.Head.Add( new XElement(Namespaces.Xhtml + "meta", new XAttribute("name", "C1.menutitle"), new XAttribute("content", page.MenuTitle))); } if (emitUrlTitleMetaTag) { xhtmlDocument.Head.Add( new XElement(Namespaces.Xhtml + "meta", new XAttribute("name", "C1.urltitle"), new XAttribute("content", page.UrlTitle))); } } } }
private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e) { EntityTokenLockedEntityToken entityToken = (EntityTokenLockedEntityToken)this.EntityToken; this.Bindings.Add("LockedByUsername", entityToken.LockedByUsername); this.Bindings.Add("IsSameUser", entityToken.LockedByUsername == UserValidationFacade.GetUsername()); }
private void initializeCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e) { var dataEntityToken = (DataEntityToken)this.EntityToken; IUser user = (IUser)dataEntityToken.Data; _deleteSelf = user.Username == UserValidationFacade.GetUsername(); }
private void context_AuthorizeRequest(object sender, EventArgs e) { var application = (HttpApplication)sender; HttpContext context = application.Context; string currentPath = context.Request.Path.ToLowerInvariant(); if (_adminRootPath == null || !currentPath.StartsWith(_adminRootPath)) { return; } if (!_allowC1ConsoleRequests) { context.Response.StatusCode = 403; context.Response.ContentType = "text/html"; string iePadding = new String('!', 512); context.Response.Write(string.Format(c1ConsoleRequestsNotAllowedHtmlTemplate, iePadding)); context.Response.End(); return; } var url = context.Request.Url; // https check if (_forceHttps && url.Scheme != "https") { if (!AlwaysAllowUnsecured(url.LocalPath) && !UserOptedOutOfHttps(context)) { context.Response.Redirect( $"{unsecureRedirectRelativePath}?fallback={_allowFallbackToHttp.ToString().ToLower()}&httpsport={_customHttpsPortNumber}"); } } // access check if (currentPath.Length > _adminRootPath.Length && !UserValidationFacade.IsLoggedIn() && !_allAllowedPaths.Any(p => currentPath.StartsWith(p, StringComparison.OrdinalIgnoreCase))) { if (currentPath.StartsWith(_servicesPath)) { context.Response.StatusCode = 403; context.Response.End(); return; } Log.LogWarning("Authorization", "DENIED {0} access to {1}", context.Request.UserHostAddress, currentPath); string redirectUrl = $"{_loginPagePath}?ReturnUrl={HttpUtility.UrlEncode(url.PathAndQuery, Encoding.UTF8)}"; context.Response.Redirect(redirectUrl, true); return; } // On authenticated request make sure these resources gets compiled / launched. if (IsConsoleOnline) { BrowserRender.EnsureReadiness(); BuildManagerHelper.InitializeControlPreLoading(); } }
protected void Page_Load(object sender, EventArgs e) { if (!UserValidationFacade.IsLoggedIn()) { Response.Redirect("/Composite/Login.aspx?ReturnUrl=" + Request.Url.PathAndQuery); return; } ScriptLoader.Render("sub"); rptCountryList.DataSource = DataFacade.GetData <Country>().Take(10) .ToArray() .Select(x => { var editLink = new EditLink() { Label = x.Name }; if (DataScopeManager.CurrentDataScope != DataScopeIdentifier.Administrated) { editLink.Link = String.Empty; return(editLink); } var teaser = x; //var editWorkflowAttribute = teaser.DataSourceId.InterfaceType.GetCustomAttributes(true).OfType<EditWorkflowAttribute>().FirstOrDefault(); //if (editWorkflowAttribute == null) //{ // editLink.Link = string.Empty; // return editLink; //} var page = PageManager.GetPageById(Guid.Parse("63ec1a73-b1ed-4ec8-923f-2840448c43ce")); var entityToken = new PageTeaserInstanceEntityToken(page, teaser); var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true); var editActionToken = new WorkflowActionToken(typeof(EditWorkflowAttribute)); var serializedActionToken = ActionTokenSerializer.Serialize(editActionToken, true); var html = String.Format("<a href=\"#\" data-providername='{0}' data-entitytoken='{1}' data-actiontoken=\"{2}\" data-piggybag='{3}' data-piggybaghash='{4}' onclick=\"executeAction(this)\">{5}</a>", teaser.DataSourceId.ProviderName, serializedEntityToken, serializedActionToken, String.Empty, HashSigner.GetSignedHash(string.Empty).Serialize(), "edit"); editLink.Link = html; return(editLink); }); rptCountryList.DataBind(); }
private void LogWorkflowChange(string change, WorkflowEventArgs args, bool logUserName, bool workflowDefinitionAvailable, bool error) { WorkflowInstance instance = null; string activityTypeName = null; try { instance = args.WorkflowInstance; } catch { // Silent } if (workflowDefinitionAvailable && instance != null) { try { activityTypeName = instance.GetWorkflowDefinition().GetType().FullName; } catch { // Silent } } var message = new StringBuilder("Workflow ").Append(change); if (activityTypeName != null) { message.Append(", Activity = " + activityTypeName); } if (instance != null) { message.Append(", Id = " + instance.InstanceId); } if (logUserName) { string identity = UserValidationFacade.IsLoggedIn() ? UserValidationFacade.GetUsername() : "(system process)"; message.Append(", User = " + identity); } if (!error) { Log.LogVerbose(LogTitle, message.ToString()); } else { Log.LogError(LogTitle, message.ToString()); } }
public MvcRenderingContext(ControllerContext context) { _context = context.HttpContext; var request = _context.Request; if (PageRenderer.CurrentPage == null) { var response = _context.Response; ProfilingEnabled = request.Url.OriginalString.Contains("c1mode=perf"); if (ProfilingEnabled) { if (!UserValidationFacade.IsLoggedIn()) { response.Write("You must be logged into <a href=\"" + GetLoginRedirectUrl(request.RawUrl) + "\">C1 console</a> to have the performance view enabled"); response.End(); return; } Profiler.BeginProfiling(); _pagePerfMeasuring = Profiler.Measure("C1 Page"); } Page = (C1PageRoute.PageUrlData ?? PageUrls.UrlProvider.ParseInternalUrl(request.Url.OriginalString)).GetPage(); _cachedUrl = request.Url.PathAndQuery; ValidateViewUnpublishedRequest(); if (Page == null) { throw new HttpException((int)HttpStatusCode.NotFound, "Page not found - either this page has not been published yet or it has been deleted."); } if ((Page.DataSourceId.PublicationScope != PublicationScope.Published) || request.IsSecureConnection) { CachingDisabled = true; response.Cache.SetCacheability(HttpCacheability.NoCache); } PageRenderer.CurrentPage = Page; PageRenderer.RenderingReason = new UrlSpace(_context).ForceRelativeUrls ? RenderingReason.C1ConsoleBrowserPageView : RenderingReason.PageView; _dataScope = new DataScope(Page.DataSourceId.PublicationScope, Page.DataSourceId.LocaleScope); } else { Page = PageRenderer.CurrentPage; } C1PageRoute.PageUrlData = new PageUrlData(Page); }
private bool UserHasRightToDownload(EntityToken file) { var userToken = UserValidationFacade.GetUserToken(); var userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username); var userGroupPermissionDefinitions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username); var requiredPermissions = DownloadFileActionToken.RequiredPermissionTypes; return(SecurityResolver.Resolve(userToken, requiredPermissions, file, userPermissionDefinitions, userGroupPermissionDefinitions) == SecurityResult.Allowed); }
private void stepFinalize_codeActivity_ExecuteCode(object sender, EventArgs e) { string newPassword = this.GetBinding <string>(Fields.NewPassword); string currentUserName = UserValidationFacade.GetUsername(); UserValidationFacade.FormSetUserPassword(currentUserName, newPassword); LoggingService.LogVerbose("ChangeOwnPasswordWorkflow", string.Format("User '{0}' has changed password.", UserValidationFacade.GetUsername()), LoggingService.Category.Audit); }
private void ValidateViewUnpublishedRequest(HttpContext httpContext) { bool isPreviewingUrl = httpContext.Request.Url.OriginalString.Contains(DefaultPageUrlProvider.UrlMarker_RelativeUrl); bool isUnpublishedPage = Page != null && Page.DataSourceId.PublicationScope != PublicationScope.Published; if ((isUnpublishedPage || isPreviewingUrl) && !UserValidationFacade.IsLoggedIn()) { string redirectUrl = GetLoginRedirectUrl(httpContext.Request.Url.OriginalString); httpContext.Response.Redirect(redirectUrl, true); } }
internal static IEnumerable <Element> FilterActions(this IEnumerable <Element> elements) { #if NO_SECURITY return(elements); #endif var userToken = UserValidationFacade.GetUserToken(); var userPermissions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username).Evaluate(); var userGroupPermissions = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username).Evaluate(); return(FilterActions(elements, userToken, userPermissions, userGroupPermissions)); }
private void ValidateViewUnpublishedRequest() { var isRelative = _context.Request.Url.OriginalString.Contains("/c1mode(relative)"); if ((((Page == null) || (Page.DataSourceId.PublicationScope == PublicationScope.Published)) && !isRelative) || UserValidationFacade.IsLoggedIn()) { return; } var loginRedirectUrl = GetLoginRedirectUrl(_context.Request.Url.OriginalString); _context.Response.Redirect(loginRedirectUrl, true); }
private bool ValidateSpecifiedPasswords(string oldPassword, string newPassword, string newPasswordConfirmed) { string currentUserName = UserValidationFacade.GetUsername(); bool oldPasswordCorrect = UserValidationFacade.FormValidateUserWithoutLogin(currentUserName, oldPassword); if (!oldPasswordCorrect) { this.ShowFieldMessage(Fields.OldPassword, Texts.ChangeOwnPasswordWorkflow_Dialog_Validation_IncorrectPassword); return(false); } if (newPassword != newPasswordConfirmed) { this.ShowFieldMessage(Fields.NewPasswordConfirmed, Texts.ChangeOwnPasswordWorkflow_Dialog_Validation_NewPasswordFieldsNotMatch); return(false); } if (newPassword == oldPassword) { this.ShowFieldMessage(Fields.NewPassword, Texts.ChangeOwnPasswordWorkflow_Dialog_Validation_PasswordsAreTheSame); return(false); } if (string.IsNullOrEmpty(newPassword)) { this.ShowFieldMessage(Fields.NewPassword, Texts.ChangeOwnPasswordWorkflow_Dialog_Validation_NewPasswordIsEmpty); return(false); } string userName = UserValidationFacade.GetUsername(); var user = DataFacade.GetData <IUser>(u => string.Compare(u.Username, userName, StringComparison.InvariantCultureIgnoreCase) == 0) .FirstOrException("No user found with name '{0}'", userName); IList <string> newPasswordValidationMessages; if (!PasswordPolicyFacade.ValidatePassword(user, newPassword, out newPasswordValidationMessages)) { foreach (var message in newPasswordValidationMessages) { this.ShowFieldMessage(Fields.NewPassword, message); } return(false); } return(true); }
public static IEnumerable <Element> FilterActions(this IEnumerable <Element> elements) { if (elements == null) { throw new ArgumentNullException("elements"); } #if NO_SECURITY return(elements); #else UserToken userToken = UserValidationFacade.GetUserToken(); IEnumerable <UserPermissionDefinition> userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username); IEnumerable <UserGroupPermissionDefinition> userGroupPermissionDefinition = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username); foreach (Element element in elements) { if (PermissionTypeFacade.IsSubBrachContainingPermissionTypes(userToken, element.ElementHandle.EntityToken, userPermissionDefinitions, userGroupPermissionDefinition)) { List <ElementAction> actionsToRemove = new List <ElementAction>(); foreach (ElementAction elementAction in element.Actions) { if (SecurityResolver.Resolve(userToken, elementAction.ActionHandle.ActionToken, element.ElementHandle.EntityToken, userPermissionDefinitions, userGroupPermissionDefinition) == SecurityResult.Disallowed) { actionsToRemove.Add(elementAction); } } foreach (ElementAction elementAction in actionsToRemove) { element.RemoveAction(elementAction); } // Drag & drop security if (element.MovabilityInfo != null) { if (SecurityResolver.Resolve(userToken, new DragAndDropActionToken(), element.ElementHandle.EntityToken, userPermissionDefinitions, userGroupPermissionDefinition) == SecurityResult.Disallowed) { element.RemoveMovabilityInfo(); } } yield return(element); } } #endif }
public void AuthenticateRequest(object sender, EventArgs e) { if (SystemSetupFacade.IsSystemFirstTimeInitialized == false) { return; } HttpApplication application = (HttpApplication)sender; HttpContext context = application.Context; bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context); if (adminRootRequest && UserValidationFacade.IsLoggedIn()) { _dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo); } }
/// <summary> /// Will filter actions (according to current users permissions) attached on the elements /// </summary> /// <param name="elements">Elements to filder</param> /// <returns>New sequence of elements, with actions filtered</returns> public static IEnumerable <Element> FilterElementsAndActions(this IEnumerable <Element> elements) { Verify.ArgumentNotNull(elements, nameof(elements)); #if NO_SECURITY return(elements); #else UserToken userToken = UserValidationFacade.GetUserToken(); var userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username).Evaluate(); var userGroupPermissionDefinition = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username).Evaluate(); return(elements .FilterElements(userToken, userPermissionDefinitions, userGroupPermissionDefinition) .FilterActions(userToken, userPermissionDefinitions, userGroupPermissionDefinition)); #endif }
private static void AuthenticateRequest(object sender, EventArgs e) { if (!SystemSetupFacade.IsSystemFirstTimeInitialized) { return; } HttpContext context = ((HttpApplication)sender).Context; bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context); if (adminRootRequest && UserValidationFacade.IsLoggedIn()) { var dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo); context.Items[HttpContextItemsKey] = dataScope; } }
protected void SetCultureInfo() { if (UserValidationFacade.IsLoggedIn()) { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = UserSettings.ActiveLocaleCultureInfo; } else { using (var data = new DataConnection()) { var activeLocales = data.Get <ISystemActiveLocale>().ToList(); if (activeLocales.Count == 1) { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo(activeLocales[0].CultureName); } } } }
private void SetWorkflowInstanceStatus(Guid instanceId, WorkflowInstanceStatus workflowInstanceStatus, bool newlyCreateOrLoaded) { using (_resourceLocker.Locker) { var resources = _resourceLocker.Resources; Action releaseIdleWaitSemaphore = () => { if (resources.WorkflowIdleWaitSemaphores.TryGetValue(instanceId, out var semaphore)) { semaphore.Release(); resources.WorkflowIdleWaitSemaphores.Remove(instanceId); } }; switch (workflowInstanceStatus) { case WorkflowInstanceStatus.Idle: releaseIdleWaitSemaphore(); resources.WorkflowStatusDictionary[instanceId] = WorkflowInstanceStatus.Idle; PersistFormData(instanceId); break; case WorkflowInstanceStatus.Running: resources.WorkflowStatusDictionary[instanceId] = WorkflowInstanceStatus.Running; break; case WorkflowInstanceStatus.Terminated: releaseIdleWaitSemaphore(); resources.WorkflowStatusDictionary.Remove(instanceId); break; default: throw new InvalidOperationException("This line should not be reachable."); } } string identity = UserValidationFacade.IsLoggedIn() ? UserValidationFacade.GetUsername() : "(system process)"; Log.LogVerbose(LogTitle, $"Workflow instance status changed to {workflowInstanceStatus}. Id = {instanceId}, User = {identity}"); }
protected void Page_Init(object sender, EventArgs e) { if (!SystemSetupFacade.IsSystemFirstTimeInitialized) { Response.Redirect("/Composite"); return; } if (UserValidationFacade.IsLoggedIn()) { RedirectToReturnUrl(); return; } if (Request.RequestType == "POST") { OnPost(); } }
/// <summary> /// Appends the c1 meta tags to the head section. Those tag are used later on by SEO assistant. /// </summary> /// <param name="page">The page.</param> /// <param name="xhtmlDocument">The XHTML document.</param> public static void AppendC1MetaTags(IPage page, XhtmlDocument xhtmlDocument) { if (UserValidationFacade.IsLoggedIn()) { bool emitMenuTitleMetaTag = string.IsNullOrEmpty(page.MenuTitle) == false; bool emitUrlMetaTag = string.IsNullOrEmpty(page.UrlTitle) == false; if (emitMenuTitleMetaTag || emitUrlMetaTag) { xhtmlDocument.Head.Add( new XComment("The C1.* meta tags are only emitted when you are logged in"), new XElement(Namespaces.Xhtml + "link", new XAttribute("rel", "schema.C1"), new XAttribute("href", "http://www.composite.net/ns/c1/seoassistant"))); if (emitMenuTitleMetaTag) { xhtmlDocument.Head.Add( new XElement(Namespaces.Xhtml + "meta", new XAttribute("name", "C1.menutitle"), new XAttribute("content", page.MenuTitle))); } if (emitUrlMetaTag) { var editPreview = PageRenderer.RenderingReason == RenderingReason.PreviewUnsavedChanges; string url = PageUrls.BuildUrl(page) ?? PageUrls.BuildUrl(page, UrlKind.Internal); var pageUrl = string.Format("{0}{1}{2}", url.Replace("/c1mode(unpublished)", "").Replace("/c1mode(relative)", ""), editPreview ? "/" + page.UrlTitle : C1PageRoute.GetPathInfo(), editPreview ? "" : HttpContext.Current.Request.Url.Query); xhtmlDocument.Head.Add( new XElement(Namespaces.Xhtml + "meta", new XAttribute("name", "C1.urlseowords"), new XAttribute("content", pageUrl))); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!UserValidationFacade.IsLoggedIn()) { Response.Redirect("~/Composite/Login.aspx?ReturnUrl=" + Request.RawUrl); } if (HttpContext.Current.Request.QueryString["badURL"] == null) { return; } _badURL = HttpContext.Current.Request.QueryString["badURL"].ToString(CultureInfo.InvariantCulture); if (!Page.IsPostBack && HttpContext.Current.Request.QueryString["badURL"] != null && txtBadURL != null) { var uri = new System.Uri(_badURL); txtBadURL.Text = uri.AbsolutePath; } }
private static void SetChangeHistoryInformation(object sender, DataEventArgs dataEventArgs) { IData data = dataEventArgs.Data; if (data != null && data is IChangeHistory) { (data as IChangeHistory).ChangeDate = DateTime.Now; try { if (UserValidationFacade.IsLoggedIn()) { (data as IChangeHistory).ChangedBy = UserValidationFacade.GetUsername(); } } catch { // silent } } }
private static void SetCreationHistoryInformation(object sender, DataEventArgs dataEventArgs) { ICreationHistory data = dataEventArgs.Data as ICreationHistory; if (data != null) { data.CreationDate = DateTime.Now; try { if (UserValidationFacade.IsLoggedIn()) { data.CreatedBy = UserValidationFacade.GetUsername(); } } catch { // silent } } }
void context_AuthenticateRequest(object sender, EventArgs e) { HttpApplication application = (HttpApplication)sender; HttpContext context = application.Context; bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context); if (adminRootRequest) { if (UserValidationFacade.IsLoggedIn()) { System.Threading.Thread.CurrentThread.CurrentCulture = C1Console.Users.UserSettings.CultureInfo; System.Threading.Thread.CurrentThread.CurrentUICulture = C1Console.Users.UserSettings.C1ConsoleUiLanguage; } else { System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Composite.Core.Configuration.GlobalSettingsFacade.DefaultCultureName); System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(Composite.Core.Configuration.GlobalSettingsFacade.DefaultCultureName); } } }
private void DoUninstallWithoutTransaction() { var userName = UserValidationFacade.IsLoggedIn() ? UserValidationFacade.GetUsername() : "<system>"; Log.LogInformation(LogTitle, $"Uninstalling package '{PackageInformation.Name}', Id = {PackageInformation.Id}. User name: '{userName}'"); try { foreach (IPackageFragmentUninstaller packageFragmentUninstaller in _packageFramentUninstallers) { packageFragmentUninstaller.Uninstall(); } } catch (Exception ex) { Log.LogError(LogTitle, ex); throw; } Log.LogInformation(LogTitle, "Package uninstalled successfully."); }
protected void Page_Load(object sender, EventArgs e) { if (!UserValidationFacade.IsLoggedIn()) { Response.Redirect(string.Format("Composite/Login.aspx?ReturnUrl={0}", HttpUtility.HtmlEncode(Request.Url.PathAndQuery))); } var backupFile = Request[BackupFilename]; if (backupFile != null) { TransmitBackup(Path.Combine(BackupDirectory, Path.GetFileName(backupFile))); } if (Page.IsPostBack) { string commandName = Request["commandName"]; if (commandName == "delete") { string deleteXMLBackupFile = Request["deleteXMLBackupFile"]; if (!string.IsNullOrWhiteSpace(deleteXMLBackupFile)) { try { C1File.Delete(Path.Combine(BackupDirectory, deleteXMLBackupFile)); } catch (Exception ex) { this.Validators.Add(new ErrorSummary(ex.Message)); } } } if (commandName == "create") { CreateBackup(); } } }
public override FormValidationRule CreateRule(FormField field) { var value = (string)field.Value; var password = (string)field.OwningForm.Fields.Get(_passwordField).Value; return(CreateRule(field, new[] { field.Name, _passwordField }, () => { var isValid = false; if (!isValid && CheckUserName) { var user = Membership.GetUser(value); isValid = IsValid(user); } if (!isValid && CheckEmail) { var username = Membership.GetUserNameByEmail(value); if (username != null) { var user = Membership.GetUser(username); if (user != null) { isValid = IsValid(user); value = username; } } } if (!isValid) { return false; } return UserValidationFacade.IsLoggedIn() || Membership.ValidateUser(value, password); })); }
void context_AuthorizeRequest(object sender, EventArgs e) { HttpApplication application = (HttpApplication)sender; HttpContext context = application.Context; bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context); if (adminRootRequest) { if (UserValidationFacade.IsLoggedIn()) { Thread.CurrentThread.CurrentCulture = UserSettings.CultureInfo; Thread.CurrentThread.CurrentUICulture = UserSettings.C1ConsoleUiLanguage; } else { var defaultCulture = CultureInfo.CreateSpecificCulture(GlobalSettingsFacade.DefaultCultureName); Thread.CurrentThread.CurrentCulture = defaultCulture; Thread.CurrentThread.CurrentUICulture = defaultCulture; } } }