Skip to content

Commit

Permalink
Merge pull request #43 from latebit-io/fix-email-urlencoding
Browse files Browse the repository at this point in the history
fix: url encode email for templates
  • Loading branch information
ontehfritz authored Dec 18, 2024
2 parents 13135ef + e91ee91 commit 8b81ef0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/Bulwark.Auth/Controllers/AccountsController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.IO;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using System.Web;
using Bulwark.Auth.Common.Payloads;
using Bulwark.Auth.Core;
using Bulwark.Auth.Core.PasswordPolicy;
Expand Down Expand Up @@ -52,7 +54,7 @@ public async Task<ActionResult> CreateAccount(Create create)
.UsingTemplate(_emailTemplate.GetTemplate("VerifyAccount"),
new
{
create.Email,
Email = HttpUtility.UrlEncode(create.Email),
VerificationToken = verificationToken.Value,
VerificationUrl = Environment.GetEnvironmentVariable("VERIFICATION_URL"),
WebsiteName = Environment.GetEnvironmentVariable("WEBSITE_NAME")
Expand Down Expand Up @@ -142,7 +144,7 @@ public async Task<ActionResult> ChangeEmail(ChangeEmail payload)
.UsingTemplate(_emailTemplate.GetTemplate("ChangeEmail"),
new
{
Email = payload.NewEmail,
Email = HttpUtility.UrlEncode(payload.NewEmail),
VerificationToken = verificationToken.Value,
VerificationUrl = Environment.GetEnvironmentVariable("VERIFICATION_URL"),
WebsiteName = Environment.GetEnvironmentVariable("WEBSITE_NAME")
Expand Down Expand Up @@ -211,7 +213,7 @@ public async Task<ActionResult> ForgotToken(string email)
.UsingTemplate(_emailTemplate.GetTemplate("Forgot"),
new
{
Email = email,
Email = HttpUtility.UrlEncode(email),
ForgotToken = token,
ForgotUrl = Environment.GetEnvironmentVariable("FORGOT_PASSWORD_URL"),
WebsiteName = Environment.GetEnvironmentVariable("WEBSITE_NAME")
Expand Down
3 changes: 2 additions & 1 deletion src/Bulwark.Auth/Controllers/PasswordLessController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using System.Web;
using Bulwark.Auth.Common.Payloads;
using Bulwark.Auth.Core;
using Bulwark.Auth.Core.Domain;
Expand Down Expand Up @@ -53,7 +54,7 @@ public async Task<ActionResult> SendMagicLink(string email)
.UsingTemplate(_emailTemplate.GetTemplate("MagicLink"),
new
{
Email = email,
Email = HttpUtility.UrlEncode(email),
Code = code,
MagicLink = Environment.GetEnvironmentVariable("MAGIC_LINK_URL"),
WebsiteName = Environment.GetEnvironmentVariable("WEBSITE_NAME")
Expand Down

0 comments on commit 8b81ef0

Please sign in to comment.