From 1e9b48bd9b4d31a8bfb7ee10c23cf1967d10d5b9 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sun, 20 Mar 2016 22:36:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=20=D0=BF=D0=BE=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=B4=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=86=D0=B8=D0=B8=20=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D1=82=D0=B8=D1=87=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B4=D0=B8=D1=80=D0=B5=D0=BA=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/actions.js | 4 +++- src/services/authFlow/CompleteState.js | 12 ++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/auth/actions.js b/src/components/auth/actions.js index 44c7175..979c46a 100644 --- a/src/components/auth/actions.js +++ b/src/components/auth/actions.js @@ -192,7 +192,9 @@ export function oAuthComplete(params = {}) { } }) .then((resp) => { - if (resp.redirectUri === 'static_page' || resp.redirectUri === 'static_page_with_code') { + if (resp.redirectUri.startsWith('static_page')) { + resp.code = resp.redirectUri.match(/code=(.+)&/)[1]; + resp.redirectUri = resp.redirectUri.match(/^(.+)\?/)[1]; resp.displayCode = resp.redirectUri === 'static_page_with_code'; dispatch(setOAuthCode({ success: resp.success, diff --git a/src/services/authFlow/CompleteState.js b/src/services/authFlow/CompleteState.js index 273df5d..f6f83a7 100644 --- a/src/services/authFlow/CompleteState.js +++ b/src/services/authFlow/CompleteState.js @@ -33,14 +33,10 @@ export default class CompleteState extends AbstractState { data.accept = this.isPermissionsAccepted; } context.run('oAuthComplete', data).then((resp) => { - switch (resp.redirectUri) { - case 'static_page': - case 'static_page_with_code': - context.setState(new FinishState()); - break; - default: - location.href = resp.redirectUri; - break; + if (resp.redirectUri.startsWith('static_page')) { + context.setState(new FinishState()); + } else { + location.href = resp.redirectUri; } }, (resp) => { // TODO