Skip to content

Commit

Permalink
MT new Yahoo login
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Jan 19, 2020
1 parent d84c875 commit 80b751a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
3 changes: 2 additions & 1 deletion dev/webpack.appmt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = new Config().extend({
}),
// CC new FaviconsPlugin('images/modtools_logo.png'),
new webpack.DefinePlugin({
APP_VERSION: JSON.stringify('0.2.23, 10 December 2019.'),
APP_VERSION: JSON.stringify('0.2.24, 19 January 2020.'),
// CC SET ABOVE: API: JSON.stringify(BASE_URL+'/api/'),
FACEBOOK_APPID: JSON.stringify('134980666550322'),
FACEBOOK_GRAFFITI_APPID: JSON.stringify('115376591981611'),
Expand All @@ -84,6 +84,7 @@ module.exports = new Config().extend({
SITE_DESCRIPTION: JSON.stringify(
"Moderating Tools for Freegle Groups"
),
YAHOO_CLIENTID: JSON.stringify('dj0yJmk9N245WTRqaDd2dnA4JmQ9WVdrOWIzTlZNMU01TjJjbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PWRh'),
MODTOOLS: true
}),
new HtmlWebpackPlugin({
Expand Down
27 changes: 17 additions & 10 deletions http/js/iznik/models/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ define([
// NO: http://stackoverflow.com/questions/17228785/yahoo-authentication-by-oauth-without-any-redirectionclient-side-is-it-possib
// NO: - looked at: OpenID solution uses window.open https://gist.github.com/erikeldridge/619947

yahooMTLogin: function () {
/* yahooMTLogin: function () {
console.log("yahooMTLogin");
var self = this;
Expand Down Expand Up @@ -653,21 +653,29 @@ define([
}
}
});
},
}, */

///////////////////////////////////////
// Request user authenticates by opening passed URL
// If user gives Ok, then pop-up window tries to open a page at ilovefreegle.
// We catch and stop this open, get passed parameters and pass them as part of repeat FD login request

yahooAuth: function (yauthurl) { // CC
yahooMTLogin: function () {
var self = this
console.log("Yahoo authenticate window open")
console.log("yahooAuth: " + yauthurl)

var authGiven = false

// CC?? var authWindow = cordova.InAppBrowser.open(yauthurl, '_blank', 'location=yes,menubar=yes');
const returnPath = '/'
const here = 'https://modtools.org/'

const yauthurl =
'https://api.login.yahoo.com/oauth2/request_auth?client_id=' +
YAHOO_CLIENTID +
'&redirect_uri=' +
encodeURIComponent(here + '/yahoologin?returnto=' + returnPath) +
'&response_type=code&language=en-us&scope=sdpp-w'

var authWindow = window.open(yauthurl, '_blank', 'location=yes,menubar=yes')

$(authWindow).on('loadstart', function (e) {
Expand All @@ -680,13 +688,12 @@ define([
var urlParams = self.extractQueryStringParams(url)
if (urlParams) {
authGiven = true
urlParams.yahoologin = true
console.log(urlParams)
//alert(JSON.stringify(urlParams))
var email = urlParams['openid.ax.value.email']
var fullname = urlParams['openid.ax.value.fullname']
localStorage.setItem('yahoo.email', email)
localStorage.setItem('yahoo.fullname', fullname)
//var email = urlParams['openid.ax.value.email']
//var fullname = urlParams['openid.ax.value.fullname']
//localStorage.setItem('yahoo.email', email)
//localStorage.setItem('yahoo.fullname', fullname)

// Try logging in again at FD
$.ajax({
Expand Down
2 changes: 1 addition & 1 deletion mobile/modtools/android/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="143" id="org.ilovefreegle.modtools" version="0.2.23" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="144" id="org.ilovefreegle.modtools" version="0.2.24" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ModTools</name>
<description>Tool to help moderators of Freegle and similar groups</description>
<author email="[email protected]" href="https://ilovefreegle.org">
Expand Down
2 changes: 1 addition & 1 deletion mobile/modtools/ios/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.ilovefreegle.modtools" ios-CFBundleVersion="148" version="0.2.23" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="org.ilovefreegle.modtools" ios-CFBundleVersion="149" version="0.2.24" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ModTools</name>
<description>Tool to help moderators of Freegle and similar groups</description>
<author email="[email protected]" href="https://ilovefreegle.org">
Expand Down

0 comments on commit 80b751a

Please sign in to comment.