You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/07 11:46:42 UTC
[incubator-ponymail-foal] 01/03: go back to whence we came if
possible
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 254947ef91494d550b2f040ba13e817f5f5164f0
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Sep 7 13:45:36 2020 +0200
go back to whence we came if possible
---
webui/js/oauth.js | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/webui/js/oauth.js b/webui/js/oauth.js
index 2e3b80a..ea4101d 100644
--- a/webui/js/oauth.js
+++ b/webui/js/oauth.js
@@ -68,6 +68,16 @@ function oauthPortal(key) {
// page.
function parseOauthResponse(json) {
if (json.okay) {
+ console.log('Checking for origin URL');
+ if (window.sessionStorage) {
+ let url = window.sessionStorage.getItem('ponymail_oauth_origin');
+ console.log('Origin is ', url);
+ if (url && url.length > 0) {
+ location.href = url;
+ return
+ }
+ }
+ console.log("No origin found, defaulting to ./");
location.href = "./" // TODO: Return to whence we came...
} else {
popup("Oauth failed", "Authentication failed: " + json.msg)
@@ -96,7 +106,7 @@ function oauthOptions() {
oobj.appendChild(document.createElement('br'))
}
}
-
+
// Mozilla Persona
if (pm_config.persona.enabled) {
var img = document.createElement('img')
@@ -137,6 +147,7 @@ function oauthWelcome(args) {
}
// Not a callback, let's just show which oauth/persona options are enabled.
} else {
- oauthOptions()
+ oauthOptions();
+ window.sessionStorage.setItem('ponymail_oauth_origin', document.referrer);
}
}
\ No newline at end of file