Skip to content

Commit 4fd9d38

Browse files
authored
Remove partial resend email functionality (#14901)
1 parent cdae83e commit 4fd9d38

File tree

3 files changed

+1
-43
lines changed

3 files changed

+1
-43
lines changed

src/Identity/UI/ref/Microsoft.AspNetCore.Identity.UI.netcoreapp.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ protected LoginModel() { }
108108
public string ReturnUrl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
109109
public virtual System.Threading.Tasks.Task OnGetAsync(string returnUrl = null) { throw null; }
110110
public virtual System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.IActionResult> OnPostAsync(string returnUrl = null) { throw null; }
111-
public virtual System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.IActionResult> OnPostSendVerificationEmailAsync() { throw null; }
112111
public partial class InputModel
113112
{
114113
public InputModel() { }

src/Identity/UI/src/Areas/Identity/Pages/V3/Account/Login.cshtml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
<p>
4242
<a asp-page="./Register" asp-route-returnUrl="@Model.ReturnUrl">Register as a new user</a>
4343
</p>
44-
<p>
45-
<button id="resend-confirmation" type="submit" asp-page-handler="SendVerificationEmail" class="btn-link" style="padding:0px;margin:0px;border:0px">Resend email confirmation</button>
46-
</p>
4744
</div>
4845
</form>
4946
</section>

src/Identity/UI/src/Areas/Identity/Pages/V3/Account/Login.cshtml.cs

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,19 @@ public class InputModel
9292
/// directly from your code. This API may change or be removed in future releases.
9393
/// </summary>
9494
public virtual Task<IActionResult> OnPostAsync(string returnUrl = null) => throw new NotImplementedException();
95-
96-
/// <summary>
97-
/// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
98-
/// directly from your code. This API may change or be removed in future releases.
99-
/// </summary>
100-
public virtual Task<IActionResult> OnPostSendVerificationEmailAsync() => throw new NotImplementedException();
10195
}
10296

10397
internal class LoginModel<TUser> : LoginModel where TUser : class
10498
{
10599
private readonly UserManager<TUser> _userManager;
106100
private readonly SignInManager<TUser> _signInManager;
107101
private readonly ILogger<LoginModel> _logger;
108-
private readonly IEmailSender _emailSender;
109102

110103
public LoginModel(SignInManager<TUser> signInManager, ILogger<LoginModel> logger,
111-
UserManager<TUser> userManager,
112-
IEmailSender emailSender)
104+
UserManager<TUser> userManager)
113105
{
114106
_userManager = userManager;
115107
_signInManager = signInManager;
116-
_emailSender = emailSender;
117108
_logger = logger;
118109
}
119110

@@ -169,34 +160,5 @@ public override async Task<IActionResult> OnPostAsync(string returnUrl = null)
169160
// If we got this far, something failed, redisplay form
170161
return Page();
171162
}
172-
173-
public override async Task<IActionResult> OnPostSendVerificationEmailAsync()
174-
{
175-
if (!ModelState.IsValid)
176-
{
177-
return Page();
178-
}
179-
180-
var user = await _userManager.FindByEmailAsync(Input.Email);
181-
if (user == null)
182-
{
183-
ModelState.AddModelError(string.Empty, "Verification email sent. Please check your email.");
184-
}
185-
186-
var userId = await _userManager.GetUserIdAsync(user);
187-
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
188-
var callbackUrl = Url.Page(
189-
"/Account/ConfirmEmail",
190-
pageHandler: null,
191-
values: new { userId = userId, code = code },
192-
protocol: Request.Scheme);
193-
await _emailSender.SendEmailAsync(
194-
Input.Email,
195-
"Confirm your email",
196-
$"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");
197-
198-
ModelState.AddModelError(string.Empty, "Verification email sent. Please check your email.");
199-
return Page();
200-
}
201163
}
202164
}

0 commit comments

Comments
 (0)