Encode ForgotPassword email link (#179)
This commit is contained in:
parent
269cff5bf5
commit
f5dcdfd8de
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
@ -374,7 +375,7 @@ namespace Company.WebApplication1.Identity.Controllers
|
||||||
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
|
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
|
||||||
var callbackUrl = Url.ResetPasswordCallbackLink(user.Id, code, Request.Scheme);
|
var callbackUrl = Url.ResetPasswordCallbackLink(user.Id, code, Request.Scheme);
|
||||||
await _emailSender.SendEmailAsync(model.Email, "Reset Password",
|
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));
|
return RedirectToAction(nameof(ForgotPasswordConfirmation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue