I have implemented authentication page in javascript for OpenWrt router and after successful login user is redirected to another web page. I need to hide the name of that page so that user is not able to bypass the authentication. Please help.
-
Does this answer your question? [How do I modify the URL without reloading the page?](https://stackoverflow.com/questions/824349/how-do-i-modify-the-url-without-reloading-the-page) – Not A Bot Mar 07 '20 at 05:25
-
actually i saw these but not able to use it in my code. is there any possibility to create soft link in java script – Saran Brar Mar 07 '20 at 05:48
2 Answers
You should set a JSON Web Token or another form of signed token when the user logs in, and then check for a valid token on each page that requires user authentication. This way, you have a secure method of ensuring that the user is logged in and has access to the requested page.
What you are describing is not secure, because any user can access any page on your website without logging in as long as they know (or are able to guess) the URL of that page.

- 35
- 7
-
Can anyone explain how to write some data in a text file in java script. I have below code to authenticate and want to write some data in text file if authentication is successful........function validate() { var username = document.getElementById("username").value; var password = document.getElementById("password").value; if ( username == "root" && password == "root@0948") { location="index1.html" } else { alert("Invalid username or password"); } return false; } – Saran Brar Mar 07 '20 at 08:35
Problem is resolved. I looked at the problem from different angle. In my javascript which was handling login module there was a parameter "location=" which was routing user to different web page if login was successful. A new shell script was created to change the location part every 1mins with current timestamp and create soft link with the webpage i wanted after login. This way actual webpage name is hidden and soft link virtual name changes every 1mins and user only sees a virtual name in the address bar.
I cannot install bigger modules like node.js as my router is TPLINK 3220 without pen drive support and i am using its current storage to run all scripts.

- 147
- 1
- 1
- 8