コード例 #1
0
        public void ResetPassword()
        {
            if (string.IsNullOrWhiteSpace(_passwordToken))
            {
                Assert.Fail("Failed to test the reset token, the token is empty.");
            }

            var result = MemberSvc.ResetPassword(_member.Id, "testNewPasswordReset", _passwordToken);

            Assert.AreEqual(true, result.IsSuccess);
        }
コード例 #2
0
        public void ExpiredResetPassword()
        {
            if (_member == null)
            {
                Assert.Fail("InvalidResetPassword: Test failed to create new member.");
            }

            string stringToken = Cryptography.DecryptToFromUrlFriendlyToken(_passwordToken);

            stringToken = Cryptography.Decrypt(stringToken, _member.CryptoKey);

            var jsnToken = JsonConvert.DeserializeObject <ResetTokenVm>(stringToken);

            jsnToken.Expire = DateTime.UtcNow.AddHours(50);
            stringToken     = JsonConvert.SerializeObject(jsnToken);
            stringToken     = Cryptography.Encrypt(stringToken, _member.CryptoKey);
            stringToken     = Cryptography.EncryptToUrlFriendly(stringToken);

            var result = MemberSvc.ResetPassword(_member.Id, "myNewSpankingPassword", stringToken);

            Assert.AreEqual(MemberManagerMessages.Error.PASSWORD_TOKEN_EXPIRED, result.Message);
        }