diff --git a/src/services/authFlow/AuthFlow.js b/src/services/authFlow/AuthFlow.js index 8f48ff6..4c2b897 100644 --- a/src/services/authFlow/AuthFlow.js +++ b/src/services/authFlow/AuthFlow.js @@ -191,8 +191,10 @@ export default class AuthFlow { * @return {bool} - whether oauth state is being restored */ restoreOAuthState() { - // TODO: Свят, тут бага - return false; + if (this.getRequest().path.indexOf('/register') === 0) { + // allow register + return; + } try { const data = JSON.parse(localStorage.getItem('oauthData')); diff --git a/tests/services/authFlow/AuthFlow.test.js b/tests/services/authFlow/AuthFlow.test.js index 6372f02..b2b8d01 100644 --- a/tests/services/authFlow/AuthFlow.test.js +++ b/tests/services/authFlow/AuthFlow.test.js @@ -96,6 +96,12 @@ describe('AuthFlow', () => { 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', () => { localStorage.setItem('oauthData', JSON.stringify({ timestamp: Date.now() - 2 * 60 * 60 * 1000,