Redirect to Login page

This commit is contained in:
Roman Hergenreder 2020-06-23 01:03:35 +02:00
parent 9e9e481576
commit 42e1ac95c8
3 changed files with 8 additions and 3 deletions

@ -15,7 +15,7 @@ $(document).ready(function() {
btn.prop("disabled", true); btn.prop("disabled", true);
btn.html("Logging in… <i class=\"fa fa-spin fa-circle-notch\"></i>"); btn.html("Logging in… <i class=\"fa fa-spin fa-circle-notch\"></i>");
jsCore.apiCall("/user/login", {"username": username, "password": password, "stayLoggedIn": stayLoggedIn }, function(data) { jsCore.apiCall("/user/login", {"username": username, "password": password, "stayLoggedIn": stayLoggedIn }, function(data) {
document.location = "/admin/dashboard"; document.location.reload();
}, function(err) { }, function(err) {
btn.html("Login"); btn.html("Login");
btn.prop("disabled", false); btn.prop("disabled", false);

2
js/admin.min.js vendored

File diff suppressed because one or more lines are too long

@ -19,7 +19,12 @@ export default class API {
body: JSON.stringify(params) body: JSON.stringify(params)
}); });
return await response.json(); let res = await response.json();
if (!res.success && res.msg === "You are not logged in.") {
document.location.reload();
}
return res;
} }
async fetchUser() { async fetchUser() {