mirror of
https://github.com/bitwarden/server
synced 2026-01-06 10:34:01 +00:00
feat(marketing-initiated-premium): (Auth) [PM-27541] Add optional marketing param to email verification link (#6604)
Adds an optional `&fromMarketing=premium` query parameter to the verification email link. Feature flag: `"pm-26140-marketing-initiated-premium-flow"`
This commit is contained in:
@@ -15,11 +15,13 @@ public class RegisterVerifyEmail : BaseMailModel
|
||||
// so we must land on a redirect connector which will redirect to the finish signup page.
|
||||
// Note 3: The use of a fragment to indicate the redirect url is to prevent the query string from being logged by
|
||||
// proxies and servers. It also helps reduce open redirect vulnerabilities.
|
||||
public string Url => string.Format("{0}/redirect-connector.html#finish-signup?token={1}&email={2}&fromEmail=true",
|
||||
public string Url => string.Format("{0}/redirect-connector.html#finish-signup?token={1}&email={2}&fromEmail=true{3}",
|
||||
WebVaultUrl,
|
||||
Token,
|
||||
Email);
|
||||
Email,
|
||||
!string.IsNullOrEmpty(FromMarketing) ? $"&fromMarketing={FromMarketing}" : string.Empty);
|
||||
|
||||
public string Token { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string FromMarketing { get; set; }
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ namespace Bit.Core.Auth.UserFeatures.Registration;
|
||||
|
||||
public interface ISendVerificationEmailForRegistrationCommand
|
||||
{
|
||||
public Task<string?> Run(string email, string? name, bool receiveMarketingEmails);
|
||||
public Task<string?> Run(string email, string? name, bool receiveMarketingEmails, string? fromMarketing);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SendVerificationEmailForRegistrationCommand : ISendVerificationEmai
|
||||
|
||||
}
|
||||
|
||||
public async Task<string?> Run(string email, string? name, bool receiveMarketingEmails)
|
||||
public async Task<string?> Run(string email, string? name, bool receiveMarketingEmails, string? fromMarketing)
|
||||
{
|
||||
if (_globalSettings.DisableUserRegistration)
|
||||
{
|
||||
@@ -92,7 +92,7 @@ public class SendVerificationEmailForRegistrationCommand : ISendVerificationEmai
|
||||
// If the user doesn't exist, create a new EmailVerificationTokenable and send the user
|
||||
// an email with a link to verify their email address
|
||||
var token = GenerateToken(email, name, receiveMarketingEmails);
|
||||
await _mailService.SendRegistrationVerificationEmailAsync(email, token);
|
||||
await _mailService.SendRegistrationVerificationEmailAsync(email, token, fromMarketing);
|
||||
}
|
||||
|
||||
// User exists but we will return a 200 regardless of whether the email was sent or not; so return null
|
||||
|
||||
Reference in New Issue
Block a user