Skip to content

Commit

Permalink
Fix race condition bug with Simple Captcha
Browse files Browse the repository at this point in the history
  • Loading branch information
TSLarson committed Oct 7, 2024
1 parent 9198b14 commit 40c4785
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
10 changes: 10 additions & 0 deletions src/connection/passwordless/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ export function initPasswordless(m, opts) {
const showTerms = opts.showTerms === undefined ? true : !!opts.showTerms;

m = initNS(m, Map({ send, mustAcceptTerms, showTerms }));

m = sync(m, 'passwordlessCaptcha', {
syncFn: (m, cb) => {
webAPI.getPasswordlessChallenge(m.get('id'), (err, r) => {
cb(null, r);
});
},
successFn: l.setPasswordlessCaptcha
});

if (opts.defaultLocation && typeof opts.defaultLocation === 'string') {
m = initLocation(m, opts.defaultLocation.toUpperCase());
} else {
Expand Down
28 changes: 0 additions & 28 deletions src/core/remote_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,5 @@ export function syncRemoteData(m) {
successFn: setCaptcha
});

m = sync(m, 'signupCaptcha', {
syncFn: (m, cb) => {
webApi.getSignupChallenge(m.get('id'), (err, r) => {
cb(null, r);
});
},
successFn: setSignupChallenge
});

m = sync(m, 'passwordlessCaptcha', {
syncFn: (m, cb) => {
webApi.getPasswordlessChallenge(m.get('id'), (err, r) => {
cb(null, r);
});
},
successFn: setPasswordlessCaptcha
});

m = sync(m, 'passwordResetCaptcha', {
syncFn: (m, cb) => {
webApi.getPasswordResetChallenge(m.get('id'), (err, r) => {
cb(null, r);
});
},
successFn: setPasswordResetCaptcha
});


return m;
}

0 comments on commit 40c4785

Please sign in to comment.