Subject: Need help redirecting users from login.html before authentication (not alogin.html)
Hello everyone,
I'm working on a MikroTik Hotspot (RouterOS) and I need help with a specific customization.
What I want to achieve:
- When a user enters a voucher code that starts with "0000" (e.g., "0000123") in the login page, they should be redirected to an external page like "winner.html" (or any URL) BEFORE authentication happens.
- Normal vouchers (not starting with 0000) should proceed with normal login.
What I have tried:
I modified alogin.html and tried using:
$(if username:startswith("0000"))window.location.href="winner.html"$(else)...
The problem:
- alogin.html only appears AFTER the user is already logged in.
- The redirect works but the user is already authenticated, which is too late.
- I cannot get any conditional logic to work inside alogin.html before the login completes.
What I need:
- A working example of how to check the username INSIDE login.html (not alogin.html) before sending the credentials to the router.
- The logic should intercept the form submission, check if the username starts with "0000", and if true, redirect to an external page without attempting to log in.
I understand that login.html is the actual login page shown to users, and alogin.html is shown after successful login. So the condition should be in login.html, not alogin.html.
Can someone provide a working code example for login.html that accomplishes this?
Thank you in advance!