Skip to content

Commit

Permalink
Use new Yahoo sign-in
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Jan 19, 2020
1 parent 80b751a commit 3bf8120
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions http/js/iznik/models/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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=' +
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 3bf8120

Please sign in to comment.