44using EssentialCSharp . Web . Services ;
55using EssentialCSharp . Web . Services . Referrals ;
66using Microsoft . AspNetCore . Authentication ;
7- using Microsoft . AspNetCore . Hosting ;
87using Microsoft . AspNetCore . Identity ;
98using Microsoft . AspNetCore . Mvc ;
109using Microsoft . AspNetCore . Mvc . RazorPages ;
1110using Microsoft . Extensions . Options ;
1211
1312namespace EssentialCSharp . Web . Areas . Identity . Pages . Account ;
1413
15- public partial class LoginModel ( SignInManager < EssentialCSharpWebUser > signInManager , UserManager < EssentialCSharpWebUser > userManager , ILogger < LoginModel > logger , IReferralService referralService , ICaptchaService captchaService , IOptions < CaptchaOptions > optionsAccessor , IWebHostEnvironment environment ) : PageModel
14+ public partial class LoginModel ( SignInManager < EssentialCSharpWebUser > signInManager , UserManager < EssentialCSharpWebUser > userManager , ILogger < LoginModel > logger , IReferralService referralService , ICaptchaService captchaService , IOptions < CaptchaOptions > optionsAccessor ) : PageModel
1615{
1716 private InputModel ? _Input ;
1817 [ BindProperty ]
@@ -69,13 +68,8 @@ public async Task<IActionResult> OnPostAsync(string? returnUrl = null)
6968 returnUrl ??= Url . Content ( "~/" ) ;
7069
7170 string ? captchaToken = Request . Form [ CaptchaOptions . HttpPostResponseKeyName ] ;
72-
73- // Development-only bypass for E2E testing: allow test tokens without verification.
74- bool isTestToken = environment . IsDevelopment ( ) && captchaToken == "10000000-aaaa-bbbb-cccc-000000000001" ;
75-
76- HCaptchaResult ? captchaResult = isTestToken
77- ? new HCaptchaResult { Success = true }
78- : await captchaService . VerifyAsync ( captchaToken , HttpContext . Connection . RemoteIpAddress ? . ToString ( ) ) ;
71+
72+ HCaptchaResult ? captchaResult = await captchaService . VerifyAsync ( captchaToken , HttpContext . Connection . RemoteIpAddress ? . ToString ( ) ) ;
7973
8074 if ( captchaResult ? . Success != true )
8175 {
@@ -100,19 +94,7 @@ public async Task<IActionResult> OnPostAsync(string? returnUrl = null)
10094 }
10195 if ( foundUser is not null )
10296 {
103- // For test tokens, bypass email confirmation requirement
104- if ( isTestToken && ! foundUser . EmailConfirmed )
105- {
106- // Temporarily set email as confirmed for this sign-in when using test token
107- var tempConfirmed = foundUser . EmailConfirmed ;
108- foundUser . EmailConfirmed = true ;
109- result = await signInManager . PasswordSignInAsync ( foundUser , Input . Password , Input . RememberMe , lockoutOnFailure : true ) ;
110- foundUser . EmailConfirmed = tempConfirmed ;
111- }
112- else
113- {
114- result = await signInManager . PasswordSignInAsync ( foundUser , Input . Password , Input . RememberMe , lockoutOnFailure : true ) ;
115- }
97+ result = await signInManager . PasswordSignInAsync ( foundUser , Input . Password , Input . RememberMe , lockoutOnFailure : true ) ;
11698 // Call the referral service to get the referral ID and set it onto the user claim
11799 _ = await referralService . EnsureReferralIdAsync ( foundUser ) ;
118100 }
0 commit comments