Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion Console/BExIS.Web.Shell/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,32 @@ public async Task<ActionResult> ForgotPassword(ForgotPasswordViewModel model)

var code = await identityUserService.GeneratePasswordResetTokenAsync(user.Id);
var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code }, Request.Url.Scheme);
await identityUserService.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");

// Create professional email template
var displayName = !string.IsNullOrEmpty(user.DisplayName) ? user.DisplayName : user.UserName;
var applicationName = BExIS.Utils.Config.GeneralSettings.ApplicationName;
if (string.IsNullOrEmpty(applicationName)) applicationName = "BEXIS2";

var emailBody = $@"
<html>
<body style='font-family: Arial, sans-serif; color: #333;'>
<p>Dear {displayName},</p>

<p>We received a request to reset the password for your account.</p>
<p>If you made this request, please reset your password by following the secure link below:</p>

<p style='margin: 20px 0;'>
<a href='{callbackUrl}' style='background-color: #007bff; color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px; display: inline-block;'>Reset your password</a>
</p>

<p>If you did not request a password reset, you can safely ignore this message. Your account will remain unchanged.</p>

<p>Best regards,<br>
Your {applicationName} Support Team</p>
</body>
</html>";

await identityUserService.SendEmailAsync(user.Id, "Reset Password", emailBody);
return RedirectToAction("ForgotPasswordConfirmation", "Account");
}
finally
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@{
ViewBag.Title = "Forgot Password Confirmation";
ViewBag.Title = "Password Reset Request Submitted";
}

@section Information
{
Just check your mails. If you are not receiving any mail from us, just try it again and/or check your junk/spam folder.
If an account with your email exists, we've sent instructions to reset your password. Please check your inbox (and your spam folder).
}

<hgroup class="title">
<h1>@ViewBag.Title.</h1>
</hgroup>
<div>
<p>
Please check your email to reset your password.
If an account with your email exists, we've sent instructions to reset your password. Please check your inbox (and your spam folder).
</p>
</div>