mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-28 07:50:32 +05:30
Fix register route blocked by oauth state restoration feature
This commit is contained in:
parent
38196e8f76
commit
abf5fbbef6
@ -191,8 +191,10 @@ export default class AuthFlow {
|
|||||||
* @return {bool} - whether oauth state is being restored
|
* @return {bool} - whether oauth state is being restored
|
||||||
*/
|
*/
|
||||||
restoreOAuthState() {
|
restoreOAuthState() {
|
||||||
// TODO: Свят, тут бага
|
if (this.getRequest().path.indexOf('/register') === 0) {
|
||||||
return false;
|
// allow register
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(localStorage.getItem('oauthData'));
|
const data = JSON.parse(localStorage.getItem('oauthData'));
|
||||||
|
@ -96,6 +96,12 @@ describe('AuthFlow', () => {
|
|||||||
expect(flow.setState, 'was called once');
|
expect(flow.setState, 'was called once');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not restore oauth state for /register route', () => {
|
||||||
|
flow.handleRequest({path: '/register'});
|
||||||
|
|
||||||
|
expect(flow.run, 'was not called'); // this.run('oAuthValidate'...
|
||||||
|
});
|
||||||
|
|
||||||
it('should not restore outdated (>1h) oauth state', () => {
|
it('should not restore outdated (>1h) oauth state', () => {
|
||||||
localStorage.setItem('oauthData', JSON.stringify({
|
localStorage.setItem('oauthData', JSON.stringify({
|
||||||
timestamp: Date.now() - 2 * 60 * 60 * 1000,
|
timestamp: Date.now() - 2 * 60 * 60 * 1000,
|
||||||
|
Loading…
Reference in New Issue
Block a user