2018-06-04 00:06:17 +08:00
|
|
|
(function (global, document) {
|
2018-06-24 10:01:21 +08:00
|
|
|
"use strict"
|
2018-06-04 00:06:17 +08:00
|
|
|
|
2018-08-08 14:08:16 +08:00
|
|
|
// 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() {
|
2018-06-24 10:01:21 +08:00
|
|
|
if (global.cookieGet("commentoOwnerToken") !== undefined) {
|
2018-12-20 13:48:43 +08:00
|
|
|
document.location = global.origin + "/dashboard";
|
2018-06-24 10:01:21 +08:00
|
|
|
}
|
2018-08-08 14:08:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-04 00:06:17 +08:00
|
|
|
// Prefills the email field from the URL parameter.
|
|
|
|
global.prefillEmail = function() {
|
2018-06-24 10:01:21 +08:00
|
|
|
if (paramGet("email") !== undefined) {
|
2018-06-04 00:06:17 +08:00
|
|
|
$("#email").val(paramGet("email"));
|
|
|
|
$("#password").click();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-12-20 13:48:43 +08:00
|
|
|
} (window.commento, document));
|