From 3bf8120eae99f51f82da999eb82f751ce7c89dc0 Mon Sep 17 00:00:00 2001 From: chriscant Date: Sun, 19 Jan 2020 22:08:25 +0000 Subject: [PATCH] Use new Yahoo sign-in --- http/js/iznik/models/session.js | 11 +++++++---- package.json | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/http/js/iznik/models/session.js b/http/js/iznik/models/session.js index 4aec7f2d8..7b8b4055e 100644 --- a/http/js/iznik/models/session.js +++ b/http/js/iznik/models/session.js @@ -667,7 +667,7 @@ define([ var authGiven = false const returnPath = '/' - const here = 'https://modtools.org/' + const here = 'https://www.ilovefreegle.org' const yauthurl = 'https://api.login.yahoo.com/oauth2/request_auth?client_id=' + @@ -676,14 +676,15 @@ define([ encodeURIComponent(here + '/yahoologin?returnto=' + returnPath) + '&response_type=code&language=en-us&scope=sdpp-w' - var authWindow = window.open(yauthurl, '_blank', 'location=yes,menubar=yes') + var authWindow = cordova.InAppBrowser.open(yauthurl, '_blank', 'location=yes,menubar=yes') $(authWindow).on('loadstart', function (e) { var url = e.originalEvent.url console.log("yloadstart: " + url) // Catch redirect after auth back to modtools - if (url.indexOf("https://modtools.org/") === 0) { + if ((url.indexOf("https://modtools.org/") === 0) || + (url.indexOf("https://www.ilovefreegle.org/") === 0)) { authWindow.close(); var urlParams = self.extractQueryStringParams(url) if (urlParams) { @@ -699,7 +700,9 @@ define([ $.ajax({ url: API + 'session', type: 'POST', - data: urlParams, + data: { + yahoocodelogin: urlParams.code + }, success: function (response) { console.log("Session login returned", response); if (response.ret === 0) { diff --git a/package.json b/package.json index f00b302a5..ca9266684 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "clean": "rimraf dist", "build:fd": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://www.ilovefreegle.org webpack --config dev/webpack.productionfd.config.js", "build:mt": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://modtools.org webpack --config dev/webpack.productionmt.config.js", - "app:fd": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://www.ilovefreegle.org webpack --config dev/webpack.appfd.config.js", - "app:mt": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://modtools.org webpack --config dev/webpack.appmt.config.js", + "app:fd": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://www.ilovefreegle.org webpack --config dev/webpack.appfd.config.js && sh tidydist.sh", + "app:mt": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://modtools.org webpack --config dev/webpack.appmt.config.js && sh tidydist.sh", "iznik:fd": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://iznik.ilovefreegle.org webpack --config dev/webpack.appfd.config.js", "iznik:mt": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://iznik.modtools.org webpack --config dev/webpack.appmt.config.js", "build:devfd": "npm run clean && cross-env NODE_ENV=production BASE_URL=https://dev.ilovefreegle.org webpack --config dev/webpack.productionfd.config.js",