@@ -20,12 +20,12 @@ public class EmailModel : PageModel
2020 {
2121 private readonly UserManager < ApplicationUser > _userManager ;
2222 private readonly SignInManager < ApplicationUser > _signInManager ;
23- private readonly IEmailSender _emailSender ;
23+ private readonly IEmailSender < ApplicationUser > _emailSender ;
2424
2525 public EmailModel (
2626 UserManager < ApplicationUser > userManager ,
2727 SignInManager < ApplicationUser > signInManager ,
28- IEmailSender emailSender )
28+ IEmailSender < ApplicationUser > emailSender )
2929 {
3030 _userManager = userManager ;
3131 _signInManager = signInManager ;
@@ -123,11 +123,10 @@ public async Task<IActionResult> OnPostChangeEmailAsync()
123123 "/Account/ConfirmEmailChange" ,
124124 pageHandler : null ,
125125 values : new { area = "Identity" , userId = userId , email = Input . NewEmail , code = code } ,
126- protocol : Request . Scheme ) ;
127- await _emailSender . SendEmailAsync (
126+ protocol : Request . Scheme ) ! ;
127+ await _emailSender . SendConfirmationLinkAsync ( user ,
128128 Input . NewEmail ,
129- "Confirm your email" ,
130- $ "Please confirm your account by <a href='{ HtmlEncoder . Default . Encode ( callbackUrl ) } '>clicking here</a>.") ;
129+ callbackUrl ) ;
131130
132131 StatusMessage = "Confirmation link to change email sent. Please check your email." ;
133132 return RedirectToPage ( ) ;
@@ -159,11 +158,10 @@ public async Task<IActionResult> OnPostSendVerificationEmailAsync()
159158 "/Account/ConfirmEmail" ,
160159 pageHandler : null ,
161160 values : new { area = "Identity" , userId = userId , code = code } ,
162- protocol : Request . Scheme ) ;
163- await _emailSender . SendEmailAsync (
164- email ,
165- "Confirm your email" ,
166- $ "Please confirm your account by <a href='{ HtmlEncoder . Default . Encode ( callbackUrl ) } '>clicking here</a>.") ;
161+ protocol : Request . Scheme ) ! ;
162+ await _emailSender . SendConfirmationLinkAsync ( user ,
163+ email ! ,
164+ callbackUrl ) ;
167165
168166 StatusMessage = "Verification email sent. Please check your email." ;
169167 return RedirectToPage ( ) ;
0 commit comments