示例#1
0
        public void TestCannotAccessUrls()
        {
            var community    = TestCommunity.LiveInAustralia.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);
            var url          = _verticalsCommand.GetCommunityHostUrl(community, "");
            var verticalHost = url.Host;

            CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName);
            Get(url);
            var homeUrl = LoggedInMemberHomeUrl.AsNonReadOnly();

            homeUrl.Host = verticalHost;
            AssertUrl(homeUrl);

            // Try to access some pages which should throw you back to the settings page.

            var settingsUrl = _settingsUrl.AsNonReadOnly();

            settingsUrl.Host = url.Host;

            var changePasswordUrl = _changePasswordUrl.AsNonReadOnly();

            changePasswordUrl.Host = url.Host;

            Get(changePasswordUrl);
            AssertUrl(settingsUrl);

            var deactivateUrl = _deactivateUrl.AsNonReadOnly();

            deactivateUrl.Host = url.Host;

            Get(deactivateUrl);
            AssertUrl(settingsUrl);
        }
示例#2
0
        public void TestCannotChangeSettings()
        {
            var community    = TestCommunity.LiveInAustralia.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);
            var url          = _verticalsCommand.GetCommunityHostUrl(community, "");
            var verticalHost = url.Host;

            CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName);
            Get(url);
            var homeUrl = LoggedInMemberHomeUrl.AsNonReadOnly();

            homeUrl.Host = verticalHost;
            AssertUrl(homeUrl);

            var settingsUrl = _settingsUrl.AsNonReadOnly();

            settingsUrl.Host = url.Host;
            Get(settingsUrl);

            Assert.IsTrue(_firstNameTextBox.IsVisible);
            Assert.IsTrue(_lastNameTextBox.IsVisible);
            Assert.IsTrue(_emailAddressTextBox.IsVisible);
            Assert.IsFalse(_secondaryEmailAddressTextBox.IsVisible);

            Assert.AreEqual(FirstName, _firstNameTextBox.Text);
            Assert.AreEqual(LastName, _lastNameTextBox.Text);
            Assert.AreEqual(EmailAddress, _emailAddressTextBox.Text);

            Assert.IsTrue(_firstNameTextBox.IsReadOnly);
            Assert.IsTrue(_lastNameTextBox.IsReadOnly);
            Assert.IsTrue(_emailAddressTextBox.IsReadOnly);
        }
示例#3
0
        public void TestLogin()
        {
            var vertical = CreateVertical();

            // Create the member first.

            var member = CreateMember(EmailAddress, FirstName, LastName, vertical.Id, true, ExternalId);

            // Try with no cookie, should be redirected.

            var url          = vertical.GetVerticalHostUrl("");
            var verticalHost = url.Host;

            Get(url);
            AssertUrl(new ReadOnlyUrl(vertical.ExternalLoginUrl, new ReadOnlyQueryString("returnUrl", url.AbsoluteUri)));

            // Set the cookie and try again, should be logged in.

            CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName, vertical.ExternalCookieDomain);
            Get(url);
            var homeUrl = LoggedInMemberHomeUrl.AsNonReadOnly();

            homeUrl.Host = verticalHost;
            AssertUrl(homeUrl);
            AssertPageContains("Logged in as <div class=\"user-name\">" + FirstName + " " + LastName + "</div>");

            // Check.

            AssertMember(EmailAddress, FirstName, LastName, vertical.Id, _membersQuery.GetMember(EmailAddress));
            Assert.IsNull(_loginCredentialsQuery.GetCredentials(member.Id));
            AssertCredentials(vertical.Id, ExternalId, _externalCredentialsQuery.GetCredentials(member.Id, vertical.Id));
        }
示例#4
0
        public void TestMissingAffiliation()
        {
            var vertical     = CreateVertical();
            var url          = vertical.GetVerticalHostUrl("");
            var verticalHost = url.Host;

            // Create the member.

            var member = CreateMember(EmailAddress, FirstName, LastName, vertical.Id, false, ExternalId);

            // Set the cookie with new name and try again.

            CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName, vertical.ExternalCookieDomain);
            Get(url);
            var homeUrl = LoggedInMemberHomeUrl.AsNonReadOnly();

            homeUrl.Host = verticalHost;
            AssertUrl(homeUrl);
            AssertPageContains("Logged in as <div class=\"user-name\">" + FirstName + " " + LastName + "</div>");

            // Check.

            AssertMember(EmailAddress, FirstName, LastName, vertical.Id, _membersQuery.GetMember(EmailAddress));
            Assert.IsNull(_loginCredentialsQuery.GetCredentials(member.Id));
            AssertCredentials(vertical.Id, ExternalId, _externalCredentialsQuery.GetCredentials(member.Id, vertical.Id));
        }
示例#5
0
        public void TestCreateAccount()
        {
            var vertical     = CreateVertical();
            var url          = vertical.GetVerticalHostUrl("");
            var verticalHost = url.Host;

            Get(url);
            AssertUrl(new ReadOnlyUrl(vertical.ExternalLoginUrl, new ReadOnlyQueryString("returnUrl", url.AbsoluteUri)));

            // Set the cookie and try again.

            CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName, vertical.ExternalCookieDomain);
            Get(url);
            var homeUrl = LoggedInMemberHomeUrl.AsNonReadOnly();

            homeUrl.Host = verticalHost;
            AssertUrl(homeUrl);

            // Check.

            var member = _membersQuery.GetMember(EmailAddress);

            AssertMember(EmailAddress, FirstName, LastName, vertical.Id, member);
            Assert.IsNull(_loginCredentialsQuery.GetCredentials(member.Id));
            AssertCredentials(vertical.Id, ExternalId, _externalCredentialsQuery.GetCredentials(member.Id, vertical.Id));
        }
示例#6
0
        public void TestLogout()
        {
            var vertical     = CreateVertical();
            var url          = vertical.GetVerticalHostUrl("");
            var verticalHost = url.Host;

            // Create the member.

            CreateMember(EmailAddress, FirstName, LastName, vertical.Id, true, ExternalId);

            // Set the cookie to login.

            CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName, vertical.ExternalCookieDomain);
            Get(url);
            var homeUrl = LoggedInMemberHomeUrl.AsNonReadOnly();

            homeUrl.Host = verticalHost;
            AssertUrl(homeUrl);
            AssertPageContains("Logged in as <div class=\"user-name\">" + FirstName + " " + LastName + "</div>");

            // Logout, should be redirected to the external login page.

            var externalLoginUrl = new ReadOnlyUrl(vertical.ExternalLoginUrl, new ReadOnlyQueryString("returnUrl", url.AbsoluteUri));

            Get(LogOutUrl);
            AssertUrl(externalLoginUrl);

            Get(url);
            AssertUrl(externalLoginUrl);
        }
示例#7
0
        public void TestDisable()
        {
            var host = HomeUrl.Host;

            // Create the member.

            var vertical = CreateVertical();
            var member   = CreateMember(true, true, vertical.Id);

            // Log in as the member.

            var url          = vertical.GetVerticalHostUrl("");
            var verticalHost = url.Host;

            CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName, vertical.ExternalCookieDomain);
            Get(url);
            var homeUrl = LoggedInMemberHomeUrl.AsNonReadOnly();

            homeUrl.Host = verticalHost;
            AssertUrl(homeUrl);
            LogOut();

            // Login.

            var administrator = _administratorAccountsCommand.CreateTestAdministrator(0);

            homeUrl      = HomeUrl.AsNonReadOnly();
            homeUrl.Host = host;
            Get(homeUrl);
            LogIn(administrator);
            Get(GetMemberUrl(member));

            // Disable.

            _disableButton.Click();

            // Check the member details.

            member.IsEnabled = false;
            AssertMember(member);

            // Check the member login.

            LogOut();
            url = vertical.GetVerticalHostUrl("");
            CreateExternalCookies(url, ExternalId, EmailAddress, FirstName + " " + LastName, vertical.ExternalCookieDomain);
            Get(url);

            var externalLoginUrl = new ReadOnlyUrl(vertical.ExternalLoginUrl, new ReadOnlyQueryString("returnUrl", url.AbsoluteUri));

            AssertUrl(externalLoginUrl);
        }