-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IAMRISK-3539] Use signup classic endpoint for captcha #2587
Changes from all commits
1035ca5
21e636a
59b50aa
e48c1fa
05e6b67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,9 +88,9 @@ export function signUp(id) { | |
autoLogin: shouldAutoLogin(m) | ||
}; | ||
|
||
const isCaptchaValid = setCaptchaParams(m, params, Flow.DEFAULT, fields); | ||
const isCaptchaValid = setCaptchaParams(m, params, Flow.SIGNUP, fields); | ||
if (!isCaptchaValid) { | ||
return showMissingCaptcha(m, id); | ||
return showMissingCaptcha(m, id, Flow.SIGNUP); | ||
} | ||
|
||
if (databaseConnectionRequiresUsername(m)) { | ||
|
@@ -131,7 +131,7 @@ export function signUp(id) { | |
|
||
const wasInvalidCaptcha = error && error.code === 'invalid_captcha'; | ||
|
||
swapCaptcha(id, Flow.DEFAULT, wasInvalidCaptcha, () => { | ||
swapCaptcha(id, Flow.SIGNUP, wasInvalidCaptcha, () => { | ||
setTimeout(() => signUpError(id, error), 250); | ||
}); | ||
}; | ||
|
@@ -290,7 +290,7 @@ export function resetPasswordSuccess(id) { | |
function resetPasswordError(id, error) { | ||
const m = read(getEntity, 'lock', id); | ||
let key = error.code; | ||
|
||
if (error.code === 'invalid_captcha') { | ||
const captchaConfig = l.passwordResetCaptcha(m); | ||
key = ( | ||
|
@@ -302,7 +302,7 @@ function resetPasswordError(id, error) { | |
const errorMessage = | ||
i18n.html(m, ['error', 'forgotPassword', key]) || | ||
i18n.html(m, ['error', 'forgotPassword', 'lock.fallback']); | ||
|
||
swapCaptcha(id, Flow.PASSWORD_RESET, error.code === 'invalid_captcha', () => { | ||
swap(updateEntity, 'lock', id, l.setSubmitting, false, errorMessage); | ||
}); | ||
|
@@ -322,11 +322,11 @@ export function showLoginActivity(id, fields = ['password']) { | |
|
||
export function showSignUpActivity(id, fields = ['password']) { | ||
const m = read(getEntity, 'lock', id); | ||
const captchaConfig = l.captcha(m); | ||
const captchaConfig = l.signupCaptcha(m); | ||
if (captchaConfig && captchaConfig.get('provider') === 'arkose') { | ||
swap(updateEntity, 'lock', id, setScreen, 'signUp', fields); | ||
} else { | ||
swapCaptcha(id, 'login', false, () => { | ||
swapCaptcha(id, Flow.SIGNUP, false, () => { | ||
swap(updateEntity, 'lock', id, setScreen, 'signUp', fields); | ||
}); | ||
} | ||
|
@@ -338,7 +338,7 @@ export function showResetPasswordActivity(id, fields = ['password']) { | |
if (captchaConfig && captchaConfig.get('provider') === 'arkose') { | ||
swap(updateEntity, 'lock', id, setScreen, 'forgotPassword', fields); | ||
} else { | ||
swapCaptcha(id, 'login', false, () => { | ||
swapCaptcha(id, Flow.PASSWORD_RESET, false, () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug fix |
||
swap(updateEntity, 'lock', id, setScreen, 'forgotPassword', fields); | ||
}); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,24 +60,5 @@ export function syncRemoteData(m) { | |
successFn: setCaptcha | ||
}); | ||
|
||
m = sync(m, 'passwordlessCaptcha', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving this due to bug with Simple CAPTCHA |
||
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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrading due to snyk warnings