From 106be9041656b327f16fa20c89ab5da52822595c Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Sat, 3 Dec 2016 15:56:51 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20oAuth=20login=20for=20blog?= =?UTF-8?q?=20urls=20which=20contain=20`/ghost`=20(#429)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue - use the configured `blogUrl` value rather than using `window.location.href` with a poor regex that was incorrectly matching on domains containing multiple `/ghost` parts such as `http://ghost.local:2368/ghost` --- ghost/admin/app/torii-providers/ghost-oauth2.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/torii-providers/ghost-oauth2.js b/ghost/admin/app/torii-providers/ghost-oauth2.js index 744d122153..7ad30e7664 100644 --- a/ghost/admin/app/torii-providers/ghost-oauth2.js +++ b/ghost/admin/app/torii-providers/ghost-oauth2.js @@ -19,7 +19,10 @@ let GhostOauth2 = Oauth2.extend({ responseParams: ['code'], // we want to redirect to the ghost admin app by default - redirectUri: window.location.href.replace(/(\/ghost)(.*)/, '$1/'), + init() { + this._super(...arguments); + this.set('redirectUri', `${this.get('config.blogUrl')}/ghost/`); + }, open(options) { if (options.type) {