login, signup: redirect to dashboard if logged in

Fixes https://gitlab.com/commento/commento-ce/issues/60
This commit is contained in:
Adhityaa Chandrasekar 2018-08-08 11:38:16 +05:30
parent 97d3d556e6
commit ee324c1f28
3 changed files with 11 additions and 0 deletions

View File

@ -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) {

View File

@ -16,6 +16,7 @@
<script>
window.onload = function() {
window.loggedInRedirect();
window.prefillEmail();
window.displayMessages();
};

View File

@ -16,6 +16,7 @@
<script>
window.onload = function() {
window.loggedInRedirect();
window.prefillEmail();
};
</script>