Encode ForgotPassword email link (#179)

This commit is contained in:
Jass Bagga 2017-12-05 12:38:19 -08:00 committed by GitHub
parent 269cff5bf5
commit f5dcdfd8de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
@ -374,7 +375,7 @@ namespace Company.WebApplication1.Identity.Controllers
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
var callbackUrl = Url.ResetPasswordCallbackLink(user.Id, code, Request.Scheme);
await _emailSender.SendEmailAsync(model.Email, "Reset Password",
$"Please reset your password by clicking here: <a href='{callbackUrl}'>link</a>");
$"Please reset your password by clicking here: <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>link</a>");
return RedirectToAction(nameof(ForgotPasswordConfirmation));
}