[Pkg-mozext-commits] [gcontactsync] 05/19: Issue #68: OAuth2 doesn't work when an HTTP server is running

David Prévot taffit at moszumanska.debian.org
Thu Apr 2 17:47:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository gcontactsync.

commit ef82b8016a9b271936a9c5fa3772669b4f2daad5
Author: Josh Geenen <joshgeenen at gmail.com>
Date:   Sun Mar 29 16:05:42 2015 -0500

    Issue #68: OAuth2 doesn't work when an HTTP server is running
---
 src/content/GHttpRequest.js              |  3 ++-
 src/content/Preferences.js               |  3 ++-
 src/content/gdata.js                     |  1 +
 src/content/options.xul                  | 16 +++++++++++++++-
 src/defaults/preferences/gContactSync.js |  2 ++
 src/locale/en-US/options.dtd             |  2 ++
 6 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/content/GHttpRequest.js b/src/content/GHttpRequest.js
index 43b8884..3cc0e87 100644
--- a/src/content/GHttpRequest.js
+++ b/src/content/GHttpRequest.js
@@ -82,7 +82,8 @@ com.gContactSync.GHttpRequest = function gCS_GHttpRequest(aType, aAuth, aUrl, aB
     this.addParameter("code", aAuth);
     this.addParameter("client_id", com.gContactSync.gdata.CLIENT_ID);
     this.addParameter("client_secret", com.gContactSync.gdata.CLIENT_SECRET);
-    this.addParameter("redirect_uri", com.gContactSync.gdata.REDIRECT_URI);
+    this.addParameter("redirect_uri", com.gContactSync.gdata.REDIRECT_URI +
+                      ":" + com.gContactSync.Preferences.mSyncPrefs.authenticationPort.value);
     this.addParameter("grant_type", com.gContactSync.gdata.TOKEN_REQUEST_GRANT_TYPE);
     break;
   case "REFRESH_REQUEST":
diff --git a/src/content/Preferences.js b/src/content/Preferences.js
index 994ecf3..cb5955e 100644
--- a/src/content/Preferences.js
+++ b/src/content/Preferences.js
@@ -215,7 +215,8 @@ com.gContactSync.Preferences = {
     numRelations:             new com.gContactSync.Pref("numRelations",              "int", 6),
     numLogsInRotation:        new com.gContactSync.Pref("numLogsInRotation",         "int", 3),
     selectFirstCardAfterDrop: new com.gContactSync.Pref("selectFirstCardAfterDrop", "bool", true),
-    notesHeight:              new com.gContactSync.Pref("notesHeight",              "char", "") 
+    notesHeight:              new com.gContactSync.Pref("notesHeight",              "char", ""),
+    authenticationPort:       new com.gContactSync.Pref("authenticationPort",        "int", 80)
   },
   /**
    * Gets a preference given its branch, name, and type
diff --git a/src/content/gdata.js b/src/content/gdata.js
index 3c7e3a8..e8c47c6 100644
--- a/src/content/gdata.js
+++ b/src/content/gdata.js
@@ -82,6 +82,7 @@ com.gContactSync.gdata = {
            "?response_type=" + com.gContactSync.gdata.RESPONSE_TYPE +
            "&client_id=" + com.gContactSync.gdata.CLIENT_ID +
            "&redirect_uri=" + com.gContactSync.gdata.REDIRECT_URI +
+           ":" + com.gContactSync.Preferences.mSyncPrefs.authenticationPort.value +
            "&scope=" + com.gContactSync.gdata.SCOPE +
            "&login_hint=" + aEmail;
   },
diff --git a/src/content/options.xul b/src/content/options.xul
index e1585a0..4dd07a4 100644
--- a/src/content/options.xul
+++ b/src/content/options.xul
@@ -16,7 +16,7 @@
    -
    - The Initial Developer of the Original Code is
    - Josh Geenen <gcontactsync at pirules.org>.
-   - Portions created by the Initial Developer are Copyright (C) 2008-2013
+   - Portions created by the Initial Developer are Copyright (C) 2008-2015
    - the Initial Developer. All Rights Reserved.
    -
    - Contributor(s):
@@ -225,6 +225,9 @@
       <preference id="httpRequestDelay"
                   name="extensions.gContactSync.httpRequestDelay"
                   type="int"/>
+      <preference id="authenticationPort"
+                  name="extensions.gContactSync.authenticationPort"
+                  type="int"/>
     </preferences>
     <vbox>
       <label value="&warning.value;"/>
@@ -307,6 +310,17 @@
                         oncommand="com.gContactSync.ThrottleTest.start(0);"/>
               </hbox>
             </row>
+            <row align="center">
+              <label control="authenticationPortBox"
+                     value="&authenticationPort.value;"
+                     accesskey="&authenticationPort.accesskey;"/>
+            </row>
+            <row align="center">
+              <textbox preference="authenticationPort"
+                       id="authenticationPortBox"
+                       maxlength="5"
+                       maxwidth="60"/>
+            </row>
           </rows>
         </grid>
       </groupbox>
diff --git a/src/defaults/preferences/gContactSync.js b/src/defaults/preferences/gContactSync.js
index 23d2a6c..017cd5d 100644
--- a/src/defaults/preferences/gContactSync.js
+++ b/src/defaults/preferences/gContactSync.js
@@ -99,6 +99,8 @@ pref("extensions.gContactSync.numLogsInRotation", 3);
 pref("extensions.gContactSync.selectFirstCardAfterDrop", true);
 // The style for the notes field in the edit contact dialog
 pref("extensions.gContactSync.notesHeight", "");
+// The port used for the redirect_uri during OAuth
+pref("extensions.gContactSync.authenticationPort", 80);
 // extended properties to sync
 pref("extensions.gContactSync.extended1", "Custom1");
 pref("extensions.gContactSync.extended2", "Custom2");
diff --git a/src/locale/en-US/options.dtd b/src/locale/en-US/options.dtd
index 667d4a4..cf49c80 100644
--- a/src/locale/en-US/options.dtd
+++ b/src/locale/en-US/options.dtd
@@ -57,6 +57,8 @@
 <!ENTITY httpRequestTimeout.accesskey     "H">
 <!ENTITY httpRequestDelay.value           "Delay between HTTP requests (ms, 0 to disable) [100]">
 <!ENTITY httpRequestDelay.accesskey       "l">
+<!ENTITY authenticationPort.value         "Authentication port [80]">
+<!ENTITY authenticationPort.accesskey     "A">
 <!ENTITY resetAll.label                   "Reset All Synced ABs">
 <!ENTITY resetAll.accesskey               "R">
 <!ENTITY cleanOldPrefs.label              "Clean Old AB Preferences">

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/gcontactsync.git



More information about the Pkg-mozext-commits mailing list