Ejemplo n.º 1
0
        private async Task <string> GenerateResetPasswordLink(ApplicationUser user, string path)
        {
            var token = await _userManager.GeneratePasswordResetTokenAsync(user);

            var link = ResetPasswordLinkGenerator.Generate(user.UserName, token, _settings.IdentityUrl, path);

            return(link);
        }
Ejemplo n.º 2
0
        public void ResetPassword_generator_should_create_correct_link()
        {
            var fakeUser       = "******";
            var fakeToken      = "123T65!adfr";
            var fakeBaseUrl    = "http://myhost:5000";
            var fakePath       = "/reset";
            var expectedResult = string.Format("http://myhost:5000/reset?token={0}&username={1}", fakeToken, fakeUser);

            var link = ResetPasswordLinkGenerator.Generate(fakeUser, fakeToken, fakeBaseUrl, fakePath);

            link.Should().Be(expectedResult);
        }