Skip to content

Commit

Permalink
refactor: fix param name inconsistency
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Oct 25, 2024
1 parent 3747a20 commit c51878a
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Coalesce.Starter.Vue.Data.Auth;

public class UserManagementService(
UserManager<User> _userManager,
UserManager<User> userManager,
IUrlHelper urlHelper,
IEmailService emailSender
)
Expand All @@ -18,7 +18,7 @@ public async Task<ItemResult> SendEmailConfirmationRequest(User user)
if (user.EmailConfirmed) return "Email is already confirmed.";
if (string.IsNullOrWhiteSpace(user.Email)) return "User has no email";

var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
var code = await userManager.GenerateEmailConfirmationTokenAsync(user);

var link = urlHelper.PageLink("/ConfirmEmail", values: new { userId = user.Id, code = code })!;

Expand All @@ -45,7 +45,7 @@ public async Task<ItemResult> SendEmailChangeRequest(User user, string newEmail)
// Regular users can only fetch themselves out of the data source,
// admins can only view users in their own tenant,
// and tenant admins can view everyone.

if (string.IsNullOrEmpty(newEmail) || !MailAddress.TryCreate(newEmail, out _))
{
return "New email is not valid.";
Expand All @@ -56,12 +56,12 @@ public async Task<ItemResult> SendEmailChangeRequest(User user, string newEmail)
return "New email is not different.";
}

var code = await _userManager.GenerateChangeEmailTokenAsync(user, newEmail);
var code = await userManager.GenerateChangeEmailTokenAsync(user, newEmail);

var link = urlHelper.PageLink("/ConfirmEmail", values: new { userId = user.Id, code = code, newEmail = newEmail })!;

var result = await emailSender.SendEmailAsync(
newEmail,
newEmail,
"Confirm your email",
$"""
Please <a href="{HtmlEncoder.Default.Encode(link)}">click here</a> to complete your email change request.
Expand All @@ -81,7 +81,7 @@ public async Task<ItemResult> SendPasswordResetRequest(User? user)
{
if (user?.Email is not null)
{
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
var code = await userManager.GeneratePasswordResetTokenAsync(user);

var link = urlHelper.PageLink("ResetPassword", values: new { userId = user.Id, code = code })!;

Expand Down

0 comments on commit c51878a

Please sign in to comment.