Esempio n. 1
0
        public void TestPasswordReset()
        {
            // Create the member.

            var member = _memberAccountsCommand.CreateTestMember(0);

            // Reset their password.

            var credentials = _loginCredentialsQuery.GetCredentials(member.Id);

            _loginCredentialsCommand.ResetPassword(member.Id, credentials);

            // Assert that they cannot log in in with their old password.

            AssertNotLoggedIn();
            AssertJsonError(ApiLogIn(member), null, "101", "Login failed. Please try again.");
            AssertNotLoggedIn();

            // Assert that they can log in with the new password.  In the test environment this is always the same password.

            var password = _passwordsCommand.GenerateRandomPassword();

            AssertJsonSuccess(ApiLogIn(member.GetLoginId(), password, false));

            Get(HomeUrl);
            AssertUrlWithoutQuery(_mustChangePasswordUrl);
            AssertPageContains(member.FullName);
        }
Esempio n. 2
0
        public void TestPasswordReset()
        {
            // Create the member.

            var member = _memberAccountsCommand.CreateTestMember(0);

            // Reset their password.

            var credentials = _loginCredentialsQuery.GetCredentials(member.Id);

            _loginCredentialsCommand.ResetPassword(member.Id, credentials);

            // Assert that they cannot log in in with their old password.

            GetLoginUrl();
            SubmitLogIn(member);
            AssertPageDoesNotContain(member.FullName);
            AssertSecureLoginUrl();

            // Assert that they can log in with the new password.  In the test environment this is always the same password.

            var password = _passwordsCommand.GenerateRandomPassword();

            GetLoginUrl();
            SubmitLogIn(member, password);
            AssertUrlWithoutQuery(_mustChangePasswordUrl);
        }
Esempio n. 3
0
        public void TestGeneratePassword()
        {
            var password = _passwordsCommand.GenerateRandomPassword();

            Assert.IsNotNull(password);
            Assert.AreEqual(password.Length, 10);
        }
Esempio n. 4
0
        void ILoginCredentialsCommand.ResetPassword(Guid userId, LoginCredentials credentials)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException("credentials");
            }

            var password = _passwordsCommand.GenerateRandomPassword();

            UpdatePassword(userId, credentials, password, true);
        }