commento/frontend/js/auth-common.js

23 lines
661 B
JavaScript
Raw Normal View History

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