From 75aa1eb241238971f669bc3a7ec05c90f6af832c Mon Sep 17 00:00:00 2001 From: Sebastien Date: Sun, 2 Dec 2018 16:39:28 +0200 Subject: [PATCH] Correct guild pop up not showing on index and redirect error --- src/main/java/net/Broken/webView/GeneralWebView.java | 6 +++--- src/main/resources/static/js/navabar.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/Broken/webView/GeneralWebView.java b/src/main/java/net/Broken/webView/GeneralWebView.java index 89453fc..efe46cc 100644 --- a/src/main/java/net/Broken/webView/GeneralWebView.java +++ b/src/main/java/net/Broken/webView/GeneralWebView.java @@ -53,7 +53,7 @@ public class GeneralWebView { model.addAttribute("isLogged", false); model.addAttribute("guild_name", ""); model.addAttribute("isAdmin", false); - return "index"; + return CheckPage.getPageIfReady("index"); } try { @@ -85,7 +85,7 @@ public class GeneralWebView { response.addCookie(cookie); } model.addAttribute("redirect_url", System.getenv("OAUTH_URL")); - return "login"; + return CheckPage.getPageIfReady("login"); } catch (NumberFormatException e){ logger.debug("Unknown guild, flush cookies"); @@ -93,7 +93,7 @@ public class GeneralWebView { cookie.setPath("/"); cookie.setMaxAge(0); response.addCookie(cookie); - return "redirect:index"; + return "redirect:/"; } diff --git a/src/main/resources/static/js/navabar.js b/src/main/resources/static/js/navabar.js index 89afc57..1e99b87 100644 --- a/src/main/resources/static/js/navabar.js +++ b/src/main/resources/static/js/navabar.js @@ -96,10 +96,10 @@ function getGuild(){ }).done(function (data) { console.log(data); $('#guild_form').empty(); - if(data.length === 0) + if(data.length === 0 && location.pathname !== "/") window.location.replace("/"); - if(data.length === 1){ + else if(data.length === 1){ Cookies.set('guild', data[0].id, { expires: 31 }); window.location.reload(true); } @@ -172,7 +172,7 @@ function checkToken() { closeOnClick: false, // Closes side-nav on clicks, useful for Angular/Meteor draggable: true // Choose whether you can drag to open on touch screens, }); - if (Cookies.get('guild') === undefined && location.pathname !== "/") { + if (Cookies.get('guild') === undefined ) { getGuild() }