mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-27 15:30:37 +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
|
||||
*/
|
||||
restoreOAuthState() {
|
||||
// TODO: Свят, тут бага
|
||||
return false;
|
||||
if (this.getRequest().path.indexOf('/register') === 0) {
|
||||
// allow register
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const data = JSON.parse(localStorage.getItem('oauthData'));
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user