Commit 76453efa by Michael Brachmann

fix

parent 65d81905
...@@ -87,48 +87,18 @@ end; ...@@ -87,48 +87,18 @@ end;
procedure StartApplication; procedure StartApplication;
begin begin
DMConnection.SetClientConfig( // Step 1: device must be registered before login is allowed
procedure(Success: Boolean; ErrorMessage: string) if not AuthService.IsDeviceRegistered then
begin begin
if Success then DisplayDeviceRegistrationView;
begin Exit;
// Step 1: device must be registered before login is allowed end;
if not AuthService.IsDeviceRegistered then
begin // Step 2: normal JWT auth check
DisplayDeviceRegistrationView; if (not AuthService.Authenticated) or AuthService.TokenExpired then
Exit; DisplayLoginView
end; else
DisplayMainView;
// Step 2: normal JWT auth check
if (not AuthService.Authenticated) or AuthService.TokenExpired then
DisplayLoginView
else
DisplayMainView;
end
else
begin
asm
var dlg = document.createElement("dialog");
dlg.classList.add("shadow", "rounded", "border", "p-4");
dlg.style.maxWidth = "500px";
dlg.style.width = "90%";
dlg.style.fontFamily = "system-ui, sans-serif";
dlg.innerHTML =
"<h5 class='fw-bold mb-3 text-danger'>emiMobile</h5>" +
"<p class='mb-3' style='white-space: pre-wrap;'>" + ErrorMessage + "</p>" +
"<div class='text-end'>" +
"<button id='refreshBtn' class='btn btn-primary'>Reload</button></div>";
document.body.appendChild(dlg);
dlg.showModal();
document.getElementById("refreshBtn").addEventListener("click", function () {
location.reload(true); // Hard refresh
});
end;
end;
end);
end; end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment