@@ -9,7 +9,6 @@ import { ApiError } from '@/server/models/Error';
99import { logger } from '@/server/lib/serverSideLogger' ;
1010import { mergeRequestState } from '@/server/lib/requestState' ;
1111import { getUser } from '@/server/lib/okta/api/users' ;
12- import { authenticate } from '@/server/lib/okta/api/authentication' ;
1312import { OktaError } from '@/server/models/okta/Error' ;
1413import {
1514 performAuthorizationCodeFlow ,
@@ -87,31 +86,6 @@ router.get(
8786 return res . type ( 'html' ) . send ( html ) ;
8887 }
8988
90- // check if the user has a password set
91- if (
92- ! user . credentials . password ||
93- /**
94- * Playwright Test
95- *
96- * This code checks if we're running in Playwright to
97- * mock the user's password
98- */
99- ( runningInPlaywright && playwrightMockStateCookie === 'noPassword' )
100- ) {
101- // if not, ask them to set a password
102- const html = renderer ( '/delete-set-password' , {
103- pageTitle : 'Create Password' ,
104- requestState : mergeRequestState ( state , {
105- queryParams : {
106- ...state . queryParams ,
107- // force the returnUrl to be the delete page after setting a password
108- returnUrl : joinUrl ( profileUrl , req . path ) ,
109- } ,
110- } ) ,
111- } ) ;
112- return res . type ( 'html' ) . send ( html ) ;
113- }
114-
11589 // get the user's attributes from the members data api
11690 const userAttributes = await getUserAttributes ( {
11791 accessToken : state . oauthState . accessToken . toString ( ) ,
@@ -251,31 +225,7 @@ router.post(
251225 ) ;
252226 }
253227
254- const { password = '' } = req . body ;
255-
256228 try {
257- const { email } = state . oauthState . idToken . claims ;
258-
259- // attempt to authenticate with okta
260- // if authentication fails, it will fall through to the catch
261- const response = await authenticate (
262- {
263- username : email as string ,
264- password,
265- } ,
266- req . ip ,
267- ) ;
268-
269- // we only support the SUCCESS status for Okta authentication in gateway
270- // Other statuses could be supported in the future https://developer.okta.com/docs/reference/api/authn/#transaction-state
271- if ( response . status !== 'SUCCESS' ) {
272- throw new ApiError ( {
273- message :
274- 'User authenticating was blocked due to unsupported Okta Authentication status property' ,
275- status : 403 ,
276- } ) ;
277- }
278-
279229 // perform the authorization code flow to get an access token specifically for deleting the user
280230 return performAuthorizationCodeFlow ( req , res , {
281231 redirectUri : ProfileOpenIdClientRedirectUris . DELETE ,
@@ -294,7 +244,7 @@ router.post(
294244 fieldErrors : [
295245 {
296246 field : 'password' ,
297- message : 'Password is incorrect' ,
247+ message : 'Password is incorrect' , //todo
298248 } ,
299249 ] ,
300250 } ,
0 commit comments