diff --git a/portfolio/src/main/java/com/google/sps/servlets/AuthenticationServlet.java b/portfolio/src/main/java/com/google/sps/servlets/AuthenticationServlet.java index 84e1a14..8728f38 100644 --- a/portfolio/src/main/java/com/google/sps/servlets/AuthenticationServlet.java +++ b/portfolio/src/main/java/com/google/sps/servlets/AuthenticationServlet.java @@ -37,11 +37,11 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro String logoutUrl = userService.createLogoutURL(redirectUrl); Pair userInfo = new Pair<>(userEmail, logoutUrl); sendJson(response, userInfo); - } else { - String loginUrl = userService.createLoginURL(redirectUrl); - Pair userInfo = new Pair<>("N/A", loginUrl); - sendJson(response, userInfo); + return; } + String loginUrl = userService.createLoginURL(redirectUrl); + Pair userInfo = new Pair<>("N/A", loginUrl); + sendJson(response, userInfo); } private void sendJson(HttpServletResponse response, Pair userInfo) throws IOException { diff --git a/portfolio/src/main/webapp/libraries.js b/portfolio/src/main/webapp/libraries.js index 8894350..043b96f 100644 --- a/portfolio/src/main/webapp/libraries.js +++ b/portfolio/src/main/webapp/libraries.js @@ -145,11 +145,11 @@ async function getLoginStatus() { if (userEmail == 'N/A') { const html = loginHtml(redirectUrl); document.getElementById('login-status').innerHTML = html; - } else { - const html = logoutHtml(userEmail, redirectUrl); - document.getElementById('login-status').innerHTML = html; - document.getElementById('comments-form').style.display = "block"; + return; } + const html = logoutHtml(userEmail, redirectUrl); + document.getElementById('login-status').innerHTML = html; + document.getElementById('comments-form').style.display = "block"; } function getEmail(json) {