-
Notifications
You must be signed in to change notification settings - Fork 555
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-3553] Swapped CAPTCHA on each reload #2558
Closed
Treterten
wants to merge
8
commits into
auth0:master
from
Treterten:iamrisk3553-fix-captcha-persistence
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f3aee39
Swapped CAPTCHA on each reload
Treterten 42e455e
Swap CAPTCHA on submission
Treterten 1c81522
Added tests for swapCaptcha
Treterten 4ec1a01
Simplified CAPTCHA tests
Treterten 8d1d28d
Fix arkose CAPTCHA bugs
Treterten cf17dca
Fix tests
Treterten 8706a54
Remove hookRunner
Treterten 326dc51
Bump version number
Treterten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "auth0-lock", | ||
"version": "12.5.0", | ||
"version": "12.5.1", | ||
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. Can we revert this please? We do not bump versions in feature PRs. |
||
"description": "Auth0 Lock", | ||
"author": "Auth0 <[email protected]> (http://auth0.com)", | ||
"license": "MIT", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
import Immutable, { List, Map } from 'immutable'; | ||
import { signUp } from '../../../connection/database/actions'; | ||
import { | ||
signUp, | ||
resetPasswordSuccess, | ||
showResetPasswordActivity, | ||
showLoginActivity, showSignUpActivity | ||
} from '../../../connection/database/actions'; | ||
import { swap, setEntity } from '../../../store'; | ||
import { swapCaptcha } from "../../../connection/captcha"; | ||
|
||
const webApiMock = () => require('core/web_api'); | ||
const coreActionsMock = () => require('core/actions'); | ||
|
||
jest.mock('core/actions', () => ({ | ||
validateAndSubmit: jest.fn() | ||
})); | ||
|
||
jest.mock('../../../connection/captcha', () => { | ||
const originalCaptcha = jest.requireActual('../../../connection/captcha'); | ||
return { | ||
__esModule: true, | ||
...originalCaptcha, | ||
swapCaptcha: jest.fn((id, flow, wasInvalid, next) => { | ||
next(); | ||
}), | ||
} | ||
}); | ||
|
||
jest.mock('core/web_api', () => ({ | ||
signUp: jest.fn() | ||
})); | ||
|
@@ -208,4 +226,85 @@ describe('database/actions.js', () => { | |
} | ||
}); | ||
}); | ||
}); | ||
|
||
describe('exported functions', () => { | ||
const id = 2; | ||
const mCaptcha = Immutable.fromJS({ | ||
field: { | ||
email: { | ||
value: '[email protected]' | ||
}, | ||
password: { | ||
value: 'testpass' | ||
}, | ||
family_name: { | ||
value: 'test-family-name' | ||
}, | ||
given_name: { | ||
value: 'test-given-name' | ||
}, | ||
name: { | ||
value: 'test-name' | ||
}, | ||
nickname: { | ||
value: 'test-nickname' | ||
}, | ||
picture: { | ||
value: 'test-pic' | ||
}, | ||
other_prop: { | ||
value: 'test-other' | ||
} | ||
}, | ||
database: { | ||
additionalSignUpFields: [ | ||
{ name: 'family_name', storage: 'root' }, | ||
{ name: 'given_name', storage: 'root' }, | ||
{ name: 'name', storage: 'root' }, | ||
{ name: 'nickname', storage: 'root' }, | ||
{ name: 'picture', storage: 'root' }, | ||
{ name: 'other_prop' } | ||
] | ||
}, | ||
captcha: { | ||
provider: 'auth0' | ||
}, | ||
passwordResetCaptcha: { | ||
provider: 'auth0' | ||
}, | ||
}); | ||
|
||
describe('resetPasswordSuccess', () => { | ||
it('runs swap CAPTCHA', () => { | ||
swap(setEntity, 'lock', id, mCaptcha); | ||
resetPasswordSuccess(id); | ||
expect(swapCaptcha.mock.calls.length).toEqual(1); | ||
}); | ||
}); | ||
|
||
describe('showResetPasswordActivity', () => { | ||
it('runs swap CAPTCHA', () => { | ||
swap(setEntity, 'lock', id, mCaptcha); | ||
showResetPasswordActivity(id); | ||
expect(swapCaptcha.mock.calls.length).toEqual(1); | ||
}); | ||
}); | ||
|
||
describe('showLoginActivity', () => { | ||
it('runs swap CAPTCHA', () => { | ||
swap(setEntity, 'lock', id, mCaptcha); | ||
showLoginActivity(id); | ||
expect(swapCaptcha.mock.calls.length).toEqual(1); | ||
}); | ||
}); | ||
|
||
describe('showSignupActivity', () => { | ||
it('runs swap CAPTCHA', () => { | ||
swap(setEntity, 'lock', id, mCaptcha); | ||
showSignUpActivity(id); | ||
expect(swapCaptcha.mock.calls.length).toEqual(1); | ||
}); | ||
}); | ||
}); | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I believe we shouldn't be manually updating version. It should only be done as part of the release.
Can you please check and revert this and corresponding changes in
package-lock.json