Fixes the request scheme, that's https.

main
Paul Schneider 7 years ago
parent c270005d5b
commit dc0199aa46
2 changed files with 4 additions and 4 deletions

@ -236,7 +236,7 @@ namespace Yavsc.Controllers
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713 // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
// Send an email with this link // Send an email with this link
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme); var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: "https");
var emailSent = await _emailSender.SendEmailAsync(model.UserName, model.Email, _localizer["ConfirmYourAccountTitle"], var emailSent = await _emailSender.SendEmailAsync(model.UserName, model.Email, _localizer["ConfirmYourAccountTitle"],
string.Format(_localizer["ConfirmYourAccountBody"], _siteSettings.Title, callbackUrl, _siteSettings.Slogan, _siteSettings.Audience)); string.Format(_localizer["ConfirmYourAccountBody"], _siteSettings.Title, callbackUrl, _siteSettings.Slogan, _siteSettings.Audience));
// No, wait for more than a login pass submission: // No, wait for more than a login pass submission:
@ -276,7 +276,7 @@ namespace Yavsc.Controllers
{ {
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
var callbackUrl = Url.Action("ConfirmEmail", "Account", var callbackUrl = Url.Action("ConfirmEmail", "Account",
new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme); new { userId = user.Id, code = code }, protocol: "https");
var res = await _emailSender.SendEmailAsync(user.UserName, user.Email, var res = await _emailSender.SendEmailAsync(user.UserName, user.Email,
this._localizer["ConfirmYourAccountTitle"], this._localizer["ConfirmYourAccountTitle"],
string.Format(this._localizer["ConfirmYourAccountBody"], string.Format(this._localizer["ConfirmYourAccountBody"],
@ -471,7 +471,7 @@ namespace Yavsc.Controllers
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713 // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
// Send an email with this link // Send an email with this link
var code = await _userManager.GeneratePasswordResetTokenAsync(user); var code = await _userManager.GeneratePasswordResetTokenAsync(user);
var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme); var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: "https");
await _emailSender.SendEmailAsync(user.UserName, user.Email, _localizer["Reset Password"], await _emailSender.SendEmailAsync(user.UserName, user.Email, _localizer["Reset Password"],
_localizer["Please reset your password by following this link:"] + " <" + callbackUrl + ">"); _localizer["Please reset your password by following this link:"] + " <" + callbackUrl + ">");
return View("ForgotPasswordConfirmation"); return View("ForgotPasswordConfirmation");

@ -37,7 +37,7 @@
<form asp-controller="Account" asp-action="LogOff" <form asp-controller="Account" asp-action="LogOff"
method="post" id="logoutForm"> method="post" id="logoutForm">
<button type="submit" class="btn navbar-btn" >@SR["Logout"]</button> <button type="submit" class="btn navbar-btn" >@SR["Logout"]</button>
<input type="hidden" name="ReturnUrl" value="@Url.Action()" /> <input type="hidden" name="ReturnUrl" value="/" />
</form> </form>
</li> </li>
</ul> </ul>

Loading…