diff --git a/frontend/js/auth-common.js b/frontend/js/auth-common.js index 9fe2b02..94dcdd3 100644 --- a/frontend/js/auth-common.js +++ b/frontend/js/auth-common.js @@ -1,5 +1,14 @@ (function (global, document) { + // Redirect the user to the dashboard if there's a cookie. If the cookie is + // invalid, they would be redirected back to the login page *after* the + // cookie is deleted. + global.loggedInRedirect = function() { + if (global.cookieGet("commentoOwnerToken") !== undefined) + document.location = "/dashboard"; + } + + // Prefills the email field from the URL parameter. global.prefillEmail = function() { if (paramGet("email") != undefined) { diff --git a/frontend/login.html b/frontend/login.html index c18076f..b19e76e 100644 --- a/frontend/login.html +++ b/frontend/login.html @@ -16,6 +16,7 @@