During login, I am performing custom authentication, for which a loader is shown with a cancel button. If the cancel button is clicked, the Login process should be terminated.
I am able to show the loader until the login returns a success/failure state. But on click of Cancel, unable to stop the Login process.
Attaching my code snippet.
In sysauth.htm
<%- if showpopup then %>
<div id="loader-popup" >
<br>Authentication in progress, please wait ...
<br>
<input type="submit" id="cancelLogin" value="Cancel" onclick="<% cancelLogin("session-id") %>">
</div>
<% end -%>
....
On click of cancel, I want to call the method
function cancelLogin(sid)
ubus("session", "destroy", {
ubus_rpc_session = sid,
})
end
My questions are,
- In which file the cancelLogin() should be included? (tried including in dispatcher.lua, index.lua & util.lua but the method's not getting called on click)
- How to terminate the running process and invoke cancelLogin()?
Any help would be appreciated.
Thanks