ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject incubator-ponymail git commit: Better handling of oauth failure
Date Thu, 03 Nov 2016 14:02:09 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 5acb78c50 -> 400da75e7


Better handling of oauth failure

Redirect back to previous page once error popup is dismissed
(At present the user is left on the auth page with nowhere to go)
Ensure storage is always cleared

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/400da75e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/400da75e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/400da75e

Branch: refs/heads/master
Commit: 400da75e7d75912ab04ad5cdd33b9e47c489a714
Parents: 5acb78c
Author: Sebb <sebb@apache.org>
Authored: Thu Nov 3 14:01:59 2016 +0000
Committer: Sebb <sebb@apache.org>
Committed: Thu Nov 3 14:01:59 2016 +0000

----------------------------------------------------------------------
 site/js/oauth.js | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/400da75e/site/js/oauth.js
----------------------------------------------------------------------
diff --git a/site/js/oauth.js b/site/js/oauth.js
index 8999654..a01d2fe 100644
--- a/site/js/oauth.js
+++ b/site/js/oauth.js
@@ -67,17 +67,16 @@ function oauthPortal(key) {
 // Callback for oauth response from backend. if okay, send user back to front
 // page.
 function parseOauthResponse(json) {
+    var wloc = "./"
+    // always clear up the storage
+    if (window.sessionStorage.getItem("ponymail_redirect_oauth")) {
+        wloc = window.sessionStorage.getItem("ponymail_redirect_oauth")
+        window.sessionStorage.removeItem("ponymail_redirect_oauth")
+    }
     if (json.okay) {
-        if (window.sessionStorage.getItem("ponymail_redirect_oauth")) {
-            var wloc = window.sessionStorage.getItem("ponymail_redirect_oauth")
-            window.sessionStorage.removeItem("ponymail_redirect_oauth")
-            location.href = wloc
-        }
-        else {
-            location.href = "./"
-        }
+        location.href = wloc
     } else {
-        popup("Oauth failed", "Authentication failed: " + json.msg)
+        popup("Oauth failed", "Authentication failed: " + json.msg, null, 10, wloc)
     }
 }
 


Mime
View raw message