Skip to content

Commit a0a90ff

Browse files
committed
refactor: drop no-user-found authData optimistic lock
1 parent 7ce0285 commit a0a90ff

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

src/RestWrite.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -585,29 +585,13 @@ RestWrite.prototype.handleAuthData = async function (authData) {
585585

586586
// No user found with provided authData we need to validate
587587
if (!results.length) {
588-
// Capture the original authData before validation mutates the adapter's view,
589-
// so that the optimistic lock below can detect single-use token consumption.
590-
const originalAuthData = currentUserAuthData
591-
? Object.fromEntries(
592-
Object.entries(currentUserAuthData).map(([k, v]) =>
593-
[k, v && typeof v === 'object' ? { ...v } : v]
594-
)
595-
)
596-
: undefined;
597588
const { authData: validatedAuthData, authDataResponse } = await Auth.handleAuthDataValidation(
598589
authData,
599590
this
600591
);
601592
this.authDataResponse = authDataResponse;
602593
// Replace current authData by the new validated one
603594
this.data.authData = validatedAuthData;
604-
// For UPDATE paths (e.g. PUT /users/:id during MFA SMS enrollment confirmation),
605-
// extend the update WHERE clause so concurrent single-use token consumers cannot
606-
// both succeed; the no-user branch is reached because findUsersWithAuthData has
607-
// no way to key on provider fields like the MFA pending token.
608-
if (this.query && this.query.objectId && Object.keys(this.data.authData).length) {
609-
applyAuthDataOptimisticLock(this.query, originalAuthData, this.data.authData);
610-
}
611595
return;
612596
}
613597

0 commit comments

Comments
 (0)