login, signup: redirect to dashboard if logged in
Fixes https://gitlab.com/commento/commento-ce/issues/60
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
  <script>
 | 
			
		||||
  window.onload = function() {
 | 
			
		||||
    window.loggedInRedirect();
 | 
			
		||||
    window.prefillEmail();
 | 
			
		||||
    window.displayMessages();
 | 
			
		||||
  };
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
  <script>
 | 
			
		||||
  window.onload = function() {
 | 
			
		||||
    window.loggedInRedirect();
 | 
			
		||||
    window.prefillEmail();
 | 
			
		||||
  };
 | 
			
		||||
  </script>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user