public async Task <ActionResult> ResetPasswordRequest(ResetPasswordRequestViewModel model) { if (!ModelState.IsValid) { return(View(model)); } using (var client = apiClient()) { ResetPasswordRoute route = externalRouteService.InternalUserResetPasswordRoute; PasswordResetRequest apiModel = new PasswordResetRequest(model.Email, route); var token = await apiClientCredential().GetClientCredentialsAsync(); var result = await client.User.ResetPasswordRequestAsync(apiModel, token.AccessToken); if (!result.ValidEmail) { ModelState.AddModelError("Email", "Email address not recognised."); return(View(model)); } ViewBag.Email = model.Email; return(View("ResetPasswordInstruction")); } }
public void GenerateUrl_WithUrlSafeValues_ReplacesPlaceholders() { // Arrange string url = "https://domain.com/" + ResetPasswordRoute.PlaceholderUserId + "/" + ResetPasswordRoute.PlaceholderToken + "/foo"; string userId = "user7"; string token = "token9"; ResetPasswordRoute route = new ResetPasswordRoute(url); route.UserID = userId; route.Token = token; // Act string result = route.GenerateUrl(); // Assert Assert.Equal("https://domain.com/user7/token9/foo", result); }
public void GenerateUrl_WithUrlSafeValues_ReplacesPlaceholders() { // Arrange string url = "https://domain.com/" + ResetPasswordRoute.PlaceholderUserId + "/" + ResetPasswordRoute.PlaceholderToken + "/foo"; string userId = "user7"; string token = "token9"; ResetPasswordRoute route = new ResetPasswordRoute(url); route.UserID = userId; route.Token = token; // Act string result = route.GenerateUrl(); // Assert Assert.Equal("https://domain.com/user7/token9/foo", result); }
public PasswordResetRequest(string emailAddress, ResetPasswordRoute route) { EmailAddress = emailAddress; Route = route; }
public PasswordResetRequest(string emailAddress, ResetPasswordRoute route) { EmailAddress = emailAddress; Route = route; }