Beispiel #1
0
        public void ResourcePackageLayoutFiles_DeleteTemplateBasedOnLayoutFile_VerifyLayoutFileExistsAndNoTemplateGenerated()
        {
            int    templatesCount = this.PageManager.GetTemplates().Count();
            string adminEmail     = "*****@*****.**";
            string adminPass      = "******";

            try
            {
                FeatherServerOperations.ResourcePackages().AddNewResourcePackage(Constants.PackageResource);
                FeatherServerOperations.ResourcePackages().WaitForTemplatesCountToIncrease(templatesCount, 3);

                AuthenticationHelper.AuthenticateUser(adminEmail, adminPass, true);
                ServerOperations.Templates().DeletePageTemplate(Constants.TemplateTestLayout1);

                string layoutFile = FeatherServerOperations.ResourcePackages().GetResourcePackageDestinationFilePath(Constants.TestPackageName, Constants.TestLayoutFileName);
                Assert.IsNotNull(layoutFile, "The layout file was not found after the template was deleted.");

                int newCount = this.PageManager.GetTemplates().Count();
                Assert.AreEqual(templatesCount + 2, newCount);
            }
            finally
            {
                AuthenticationHelper.AuthenticateUser(adminEmail, adminPass, true);
                ServerOperations.Templates().DeletePageTemplate(Constants.TemplateTestLayout2);
                ServerOperations.Templates().DeletePageTemplate(Constants.TemplateTestLayout3);

                string path = FeatherServerOperations.ResourcePackages().GetResourcePackagesDestination(Constants.TestPackageName);
                FeatherServerOperations.ResourcePackages().DeleteDirectory(path);
            }
        }
    private void Login1_LoggedIn(object sender, EventArgs e)
    {
        // ScreenLock - unlock screen
        IsScreenLocked = false;

        // Ensure response cookie
        CookieHelper.EnsureResponseCookie(FormsAuthentication.FormsCookieName);

        // Set cookie expiration
        if (Login1.RememberMeSet)
        {
            CookieHelper.ChangeCookieExpiration(FormsAuthentication.FormsCookieName, DateTime.Now.AddYears(1), false);
        }
        else
        {
            // Extend the expiration of the authentication cookie if required
            if (!AuthenticationHelper.UseSessionCookies && (HttpContext.Current != null) && (HttpContext.Current.Session != null))
            {
                CookieHelper.ChangeCookieExpiration(FormsAuthentication.FormsCookieName, DateTime.Now.AddMinutes(Session.Timeout), false);
            }
        }

        // Current username
        string userName = Login1.UserName;

        // Get info on the authenticated user
        UserInfo ui = UserInfo.Provider.Get(userName);

        // Check whether safe user name is required and if so get safe username
        if (ui == null && AuthenticationMode.IsMixedAuthentication() && UserInfoProvider.UseSafeUserName)
        {
            userName = ValidationHelper.GetSafeUserName(userName, SiteContext.CurrentSiteName);

            AuthenticationHelper.AuthenticateUser(userName, Login1.RememberMeSet);
        }

        // Set culture
        CMSDropDownList drpCulture = (CMSDropDownList)Login1.FindControl("drpCulture");

        if (drpCulture != null)
        {
            string selectedCulture = drpCulture.SelectedValue;

            // Not the default culture
            if (selectedCulture != "")
            {
                // Update the user
                if (ui != null)
                {
                    ui.PreferredUICultureCode = selectedCulture;
                    UserInfo.Provider.Set(ui);
                }

                // Update current user
                MembershipContext.AuthenticatedUser.PreferredUICultureCode = selectedCulture;
            }
        }

        URLHelper.LocalRedirect(ReturnUrl);
    }
 public void ChangeUserRole()
 {
     ServerOperations.Users().LogoutUser();
     AuthenticationHelper.AuthenticateUser(AdminUser, AdminPassword);
     ServerOperationsFeather.Users().RemoveUserFromRole(Editors, RoleProvider, User);
     ServerOperationsFeather.Users().AddUserToRole(Designers, RoleProvider, User);
     ServerOperationsFeather.Pages().RepublishPage(HomePage);
 }
Beispiel #4
0
        public void DeleteGridWidgetFromFileSystem()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            string filePath = FileInjectHelper.GetDestinationFilePath(this.gridPath);

            File.Delete(filePath);
        }
Beispiel #5
0
 public void TearDown()
 {
     AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);
     ServerOperations.Configuration().EnableRatings(false);
     ServerOperations.Pages().DeleteAllPages();
     ServerOperations.News().DeleteAllNews();
     ServerOperations.Comments().DeleteAllComments(this.key);
 }
Beispiel #6
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);
            this.CreateLayoutFolderAndCopyLayoutFile();
            var templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);

            ServerOperations.Pages().CreatePage(PageName, templateId);
        }
Beispiel #7
0
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            ServerOperations.Comments().RequireAuthentication(ThreadType, false);
            ServerOperations.Pages().DeleteAllPages();
            ServerOperations.News().DeleteAllNews();
            ServerOperations.Comments().DeleteAllComments(this.key);
        }
 public void TearDown()
 {
     AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);
     ServerOperations.Comments().RequireAuthentication(ThreadType, false);
     ServerOperations.Configuration().EnableRatings(false);
     ServerOperations.Pages().DeleteAllPages();
     ServerOperations.News().DeleteAllNews();
     ServerOperations.Comments().DeleteAllComments(this.key);
 }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);

            var pageId = ServerOperations.Pages().CreatePage(PageTitle);

            ServerOperationsFeather.Pages().AddRegistrationWidgetToPage(pageId);
            ServerOperationsFeather.Pages().AddProfileWidgetToPage(pageId);
        }
Beispiel #10
0
        /// <summary>
        /// Authenticates user
        /// </summary>
        /// <returns></returns>
        private void AuthenticateUser(string un, string pwd)
        {
            // Get the user
            UserInfo user = UserInfoProvider.GetUserInfo(un);

            if (user != null)
            {
                AuthenticationHelper.AuthenticateUser(un, pwd, SiteContext.CurrentSiteName);
            }
        }
Beispiel #11
0
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            ServerOperations.Pages().DeleteAllPages();
            string filePath = FileInjectHelper.GetDestinationFilePath(this.gridPath);

            File.Delete(filePath);
            FeatherServerOperations.GridWidgets().RemoveGridControlFromToolboxesConfig(GridTitle);
        }
 public void TearDown()
 {
     ServerOperations.Users().LogoutUser();
     AuthenticationHelper.AuthenticateUser(AdminUser, AdminPassword);
     ServerOperations.Pages().DeleteAllPages();
     ServerOperations.Documents().DeleteAllLibrariesExceptDefaultOne();
     ServerOperations.Users().DeleteUserAndProfile(AuthorUserName1);
     ServerOperations.Users().DeleteUserAndProfile(AuthorUserName2);
     ServerOperations.Roles().DeleteRoles(new string[] { RoleName1, RoleName2 });
 }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);
            var providerName = ContentManager.GetManager().Provider.Name;

            ServerOperationsFeather.ContentBlockOperations().CreateContentBlock(ContentBlockTitle, ContentBlockContent, providerName);
            Guid page1Id = ServerOperations.Pages().CreatePage(PageName);

            ServerOperationsFeather.Pages().AddSharedContentBlockWidgetToPage(page1Id, ContentBlockTitle);
        }
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            ServerOperations.Templates().DeletePageTemplate(TemplateTitle);

            string filePath = FeatherServerOperations.ResourcePackages().GetResourcePackageDestinationFilePath(PackageName, LayoutFileName);

            File.Delete(filePath);
        }
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            ServerOperations.Pages().DeleteAllPages();
            var siteID = ServerOperations.Comments().GetCurrentSiteId.ToString();

            ServerOperations.Comments().DeleteAllComments(siteID);
            ServerOperations.Comments().AllowComments(ThreadType, false);
        }
Beispiel #16
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);
            ServerOperationsFeather.DynamicModules().EnsureModuleIsImported(ModuleName, ModuleResource);

            ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(DynamicTitle, DynamicUrl);
            Guid pageId = ServerOperations.Pages().CreatePage(PageName);

            ServerOperationsFeather.Pages().AddDynamicWidgetToPage(pageId, ResolveType, WidgetName, WidgetCaptionDynamicWidget);
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);
            ServerOperations.ContentBlocks().CreateSecondDataProvider();
            Guid page1Id      = ServerOperations.Pages().CreatePage(PageName);
            var  providerName = ContentManager.GetManager().Provider.Name;

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(page1Id, Content);
            ServerOperationsFeather.ContentBlockOperations().CreateContentBlock("Content Block 1", "Content 1", providerName);
            ServerOperationsFeather.ContentBlockOperations().CreateContentBlock("Content Block 2", "Content 2", SecondProviderName);
        }
Beispiel #18
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);
            ServerOperations.Configuration().EnableRatings(true);
            ServerOperations.News().CreatePublishedNewsItemLiveId(NewsTitle, NewsContent, NewsAuthor, NewsSource);
            Guid templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId     = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddNewsWidgetToPage(pageId, "Contentplaceholder1");
        }
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);

            ServerOperations.Pages().DeleteAllPages();
            var siteID = ServerOperations.Comments().GetCurrentSiteId.ToString();

            ServerOperations.Comments().DeleteAllComments(siteID);
            ServerOperations.Comments().AllowComments(ThreadType, false);
            ServerOperations.Users().DeleteUserAndProfile(NewUserEmail);
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);
            ServerOperationsFeather.DynamicModules().EnsureModuleIsImported(ModuleName, ModuleResource);

            Guid pageId = ServerOperations.Pages().CreatePage(PageName);

            ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(ItemsTitle, ItemsTitle + "Url");

            ServerOperationsFeather.Pages().AddDynamicWidgetToPage(pageId, "Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle", "PressArticle", "Press Articles MVC");
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            ServerOperations.Comments().AllowComments(ThreadType, true);
            Guid templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId     = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddCommentsWidgetToPage(pageId, "Contentplaceholder1");
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);

            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid pageId     = ServerOperations.Pages().CreatePage(PageTitle, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddRegistrationWidgetToPage(pageId, PlaceHolderId);
            ServerOperationsFeather.Pages().AddProfileWidgetToPage(pageId, PlaceHolderId);
        }
 protected void btnWebSite_onClick(object sender, EventArgs e)
 {
     if (!VirtualPathHelper.UsingVirtualPathProvider)
     {
         AuthenticationHelper.AuthenticateUser(UserInfoProvider.AdministratorUserName, false);
         URLHelper.Redirect(ApplicationUrlHelper.GetApplicationUrl("cms", "administration"));
     }
     else
     {
         URLHelper.Redirect(ResolveUrl("~/default.aspx"));
     }
 }
Beispiel #24
0
        public ClaimsPrincipal Validate(string username, string password)
        {
            ClaimsPrincipal retval      = null;
            var             defaultSite = BridgeConfiguration.GetConfig().DefaultSite;
            var             authUser    = AuthenticationHelper.AuthenticateUser(username, password, defaultSite, false);

            if (authUser != null)
            {
                retval = new ClaimsPrincipal(new GenericIdentity(username));
            }
            return(retval);
        }
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser(UserName, Password);

            ServerOperations.Pages().DeleteAllPages();

            string filePath = FeatherServerOperations.ResourcePackages().GetResourcePackageMvcViewDestinationFilePath(PackageName, WidgetName, ViewFileName);

            FileInfo      fi = new FileInfo(filePath);
            DirectoryInfo di = fi.Directory;

            FeatherServerOperations.ResourcePackages().DeleteDirectory(di.FullName);
        }
        public void CreateMultilingualSite()
        {
            AuthenticationHelper.AuthenticateUser(AdminEmail, AdminPass);
            var siteName     = ArrangementConfig.GetArrangementSite();
            var siteUrl      = ArrangementConfig.GetArrangementSiteUrl();
            var siteCultures = ArrangementConfig.GetArrangementSiteCultures();
            var site         = new SiteModel(siteName, siteUrl, siteName + "Provider", true)
            {
                Cultures = siteCultures
            };

            MultisiteHelper.CreateSite(site);
        }
Beispiel #27
0
        public void TearDown()
        {
            AuthenticationHelper.AuthenticateUser("admin", "admin@2", true);
            ServerOperations.Comments().SetCommentsNotificationProfile("Default");
            NotificationsTestHelper.ResetDummySmtpSenderData(profileName: UnsubscribeUserForReviewsNotification.NotificationsProfileName, cleanOnly: true);

            ServerOperations.Pages().DeleteAllPages();
            var siteID = ServerOperations.Comments().GetCurrentSiteId.ToString();

            ServerOperations.Comments().DeleteAllComments(siteID);
            ServerOperations.Comments().AllowComments(ThreadType, false);
            ServerOperations.Comments().EnableEmailSubscription(ThreadType, false);
        }
Beispiel #28
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);
            Guid selectorPageId = ServerOperations.Pages().CreatePage(LinkSelectorPageName);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(selectorPageId);

            Guid parentPageId = ServerOperations.Pages().CreatePage(ParentPageName);

            Guid childPageId = Guid.NewGuid();

            ServerOperations.Pages().CreatePage(ChildPageName, childPageId, parentPageId);
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);

            var pageId = ServerOperations.Pages().CreatePage(PageTitle);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(pageId, ContentBlockText);

            Guid templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId1    = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageTitle1, templateId);

            pageId1 = ServerOperations.Pages().GetPageNodeId(pageId1);
            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(pageId1, ContentBlockText1, PlaceHolderId);
        }
Beispiel #30
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);
            ServerOperationsFeather.DynamicModules().EnsureModuleIsImported(ModuleName, ModuleResource);

            Guid pageId = ServerOperations.Pages().CreatePage(PageName);

            for (int i = 0; i < 20; i++)
            {
                items[i] = ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(DynamicItemTitle + i, DynamicItemTitle + i + "Url").Id;
            }

            ServerOperationsFeather.Pages().AddDynamicWidgetToPage(pageId, "Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle", "PressArticle", "Press Articles MVC");
        }
        public ActionResult Index(IndexModel model)
        {
            if (!ModelState.IsValid)
                return View();

            var authenticationHelper = new AuthenticationHelper(_userService);
            try
            {
                authenticationHelper.AuthenticateUser(model.Username, model.Password);
            }
            catch (InvalidUserCredentialsException)
            {
                ModelState.AddModelError("", "Please enter a valid username and password.");
                return View();
            }

            return RedirectToAction("Index", "Account");
        }