@@ -86,22 +86,12 @@ public async Task ActivationFlow_ViaEmailLink_ActivatesAccount()
8686 // --- Password Reset ---
8787
8888 [ Test ]
89- public async Task V1PasswordReset_SendsPasswordResetEmail ( )
89+ public async Task V1PasswordReset_Retired_Returns410Gone ( )
9090 {
91- var email = TestHelper . UniqueEmail ( "mail-pwreset" ) ;
92- var username = TestHelper . UniqueUsername ( "mailpwreset" ) ;
93- using var mailpit = WebApplicationFactory . CreateMailpitHelper ( ) ;
94-
95- await TestHelper . CreateUserInDb ( WebApplicationFactory , username , email , "OldPassword123#" ) ;
96-
9791 using var client = WebApplicationFactory . CreateClient ( ) ;
98- var response = await client . PostAsync ( "/1/account/reset" , TestHelper . JsonContent ( new { email } ) ) ;
92+ var response = await client . PostAsync ( "/1/account/reset" , TestHelper . JsonContent ( new { email = "whatever@test.org" } ) ) ;
9993
100- await Assert . That ( response . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
101-
102- var message = await mailpit . WaitForMessageAsync ( email ) ;
103- await Assert . That ( message ) . IsNotNull ( ) ;
104- await Assert . That ( message ! . To ? . Select ( c => c . Address ) ) . Contains ( email ) ;
94+ await Assert . That ( response . StatusCode ) . IsEqualTo ( HttpStatusCode . Gone ) ;
10595 }
10696
10797 [ Test ]
@@ -140,7 +130,7 @@ public async Task PasswordResetFlow_ViaEmailLink_ChangesPassword()
140130 using var client = WebApplicationFactory . CreateClient ( ) ;
141131
142132 // Initiate password reset
143- var resetResponse = await client . PostAsync ( "/1 /account/reset" , TestHelper . JsonContent ( new { email } ) ) ;
133+ var resetResponse = await client . PostAsync ( "/2 /account/password- reset" , TestHelper . JsonContent ( new { email , turnstileResponse = "valid-token" } ) ) ;
144134 await Assert . That ( resetResponse . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
145135
146136 // Wait for reset email and extract the link
@@ -166,10 +156,11 @@ public async Task PasswordResetFlow_ViaEmailLink_ChangesPassword()
166156 await Assert . That ( completeResponse . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
167157
168158 // Confirm we can log in with the new password
169- var loginResponse = await client . PostAsync ( "/1 /account/login" , TestHelper . JsonContent ( new
159+ var loginResponse = await client . PostAsync ( "/2 /account/login" , TestHelper . JsonContent ( new
170160 {
171- email ,
172- password = newPassword
161+ usernameOrEmail = email ,
162+ password = newPassword ,
163+ turnstileResponse = "valid-token"
173164 } ) ) ;
174165 await Assert . That ( loginResponse . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
175166 }
@@ -331,7 +322,7 @@ public async Task PasswordResetComplete_LegacyRecoverRoute_StillWorks()
331322
332323 using var client = WebApplicationFactory . CreateClient ( ) ;
333324
334- var resetResponse = await client . PostAsync ( "/1 /account/reset" , TestHelper . JsonContent ( new { email } ) ) ;
325+ var resetResponse = await client . PostAsync ( "/2 /account/password- reset" , TestHelper . JsonContent ( new { email , turnstileResponse = "valid-token" } ) ) ;
335326 await Assert . That ( resetResponse . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
336327
337328 var message = await mailpit . WaitForMessageAsync ( email ) ;
@@ -346,10 +337,11 @@ public async Task PasswordResetComplete_LegacyRecoverRoute_StillWorks()
346337 TestHelper . JsonContent ( new { password = newPassword } ) ) ;
347338 await Assert . That ( completeResponse . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
348339
349- var loginResponse = await client . PostAsync ( "/1 /account/login" , TestHelper . JsonContent ( new
340+ var loginResponse = await client . PostAsync ( "/2 /account/login" , TestHelper . JsonContent ( new
350341 {
351- email ,
352- password = newPassword
342+ usernameOrEmail = email ,
343+ password = newPassword ,
344+ turnstileResponse = "valid-token"
353345 } ) ) ;
354346 await Assert . That ( loginResponse . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
355347 }
@@ -364,7 +356,7 @@ public async Task PasswordResetCheck_LegacyHeadRecoverRoute_StillWorks()
364356 await TestHelper . CreateUserInDb ( WebApplicationFactory , username , email , "OldPassword123#" ) ;
365357
366358 using var client = WebApplicationFactory . CreateClient ( ) ;
367- var resetResponse = await client . PostAsync ( "/1 /account/reset" , TestHelper . JsonContent ( new { email } ) ) ;
359+ var resetResponse = await client . PostAsync ( "/2 /account/password- reset" , TestHelper . JsonContent ( new { email , turnstileResponse = "valid-token" } ) ) ;
368360 await Assert . That ( resetResponse . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
369361
370362 var message = await mailpit . WaitForMessageAsync ( email ) ;
@@ -463,10 +455,10 @@ public async Task PasswordResetFlow_SecondPendingResetInvalidatedAfterFirstCompl
463455 using var client = WebApplicationFactory . CreateClient ( ) ;
464456
465457 // Fire two reset requests back-to-back, then wait for both emails to land.
466- var firstInit = await client . PostAsync ( "/1 /account/reset" , TestHelper . JsonContent ( new { email } ) ) ;
458+ var firstInit = await client . PostAsync ( "/2 /account/password- reset" , TestHelper . JsonContent ( new { email , turnstileResponse = "valid-token" } ) ) ;
467459 await Assert . That ( firstInit . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
468460
469- var secondInit = await client . PostAsync ( "/1 /account/reset" , TestHelper . JsonContent ( new { email } ) ) ;
461+ var secondInit = await client . PostAsync ( "/2 /account/password- reset" , TestHelper . JsonContent ( new { email , turnstileResponse = "valid-token" } ) ) ;
470462 await Assert . That ( secondInit . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
471463
472464 var messages = await mailpit . WaitForMessagesAsync ( email , minCount : 2 ) ;
@@ -500,10 +492,11 @@ public async Task PasswordResetFlow_SecondPendingResetInvalidatedAfterFirstCompl
500492 await Assert . That ( completeB . StatusCode ) . IsEqualTo ( HttpStatusCode . NotFound ) ;
501493
502494 // Password from the winning reset works
503- var loginResponse = await client . PostAsync ( "/1 /account/login" , TestHelper . JsonContent ( new
495+ var loginResponse = await client . PostAsync ( "/2 /account/login" , TestHelper . JsonContent ( new
504496 {
505- email ,
506- password = firstNewPassword
497+ usernameOrEmail = email ,
498+ password = firstNewPassword ,
499+ turnstileResponse = "valid-token"
507500 } ) ) ;
508501 await Assert . That ( loginResponse . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
509502 }
0 commit comments