Hi
It is a great tutorial and I got it working on my site (I am using google sites). I have no idea about javascript but I am good at reading stuff on internet and replicating it. I want an extension to the code such that when the form is submitted, a validation of password is done (which is a field in my form) and if it meets the hardcoded password mentioned in the code, then a specific page is opened in a new tab else a message is displayed saying "Incorrect password".
If this is for a login page/anything that stores user information, passwords stored in plaintext are a bad practice. There is no simple method around this to handle passwords securely that I am aware of, so I would not recommend using this workflow for passwords or security related matters. Encryption is too important these days; you must safeguard user's data.
Thanks for writing back. This is not for storing login information. I have put designs for my customers to view online and I want to capture the information of all customers who visit to view my online designs. Hard coded password is to keep my competition away from accessing my designs. People here are not that tech savy and hence would never be able to figure out my hard coded password.
Ok - so this is a single hard coded password to grant permission to enter a page, i.e., password protection.
I would recommend putting the validation on the server then. Since this is hardcoded, then it isn't as risky. Apologies but I care too much about security and have to make sure this isn't abused for storing user passwords.
You could return a success or failure on the request sent to the server, and use error handling to process clientside, and if there is a special URL or anything I'd recommend storing that on the server and returning it with the network request after validation. And you'll wanna make sure that this page is not indexed by Google/search sites or anyone may be able to find it.
Honestly I'd recommend looking up password protection for whatever service if that is what you need as that may be simpler than setting all this up, but that's up to you.
I have tried everything that I could find on internet. Since, I dont understand any coding, is it possible for you to give me a code which can be put on server and the part of code that needs to be put in the page such that specific URL opens if the password entered is correct.
GitHub is a platform for sharing open-source software. This tutorial is provided free, with lots of built in advanced sections and examples.
Your use-case is a little specific, and as I made in my last point above, if password protection is what you want, there are built in ways of doing that on various services. I think you can do that natively on a web server. Why reinvent the wheel just because?
That being said, yes it should totally be possible to do this from the tutorial, but this requires someone to code it up. What you are for is someone to spend their time to produce something for you for free. If someone has a similar use-case and wants to contribute to our repo a new advanced section of the tutorial, I am all down for that. But, typically, people contract out developers when they want something built that doesn't exist and they lack the coding ability to do so themselves.
Thanks for all the help. As said earlier, it works great.
Most helpful comment
GitHub is a platform for sharing open-source software. This tutorial is provided free, with lots of built in advanced sections and examples.
Your use-case is a little specific, and as I made in my last point above, if password protection is what you want, there are built in ways of doing that on various services. I think you can do that natively on a web server. Why reinvent the wheel just because?
That being said, yes it should totally be possible to do this from the tutorial, but this requires someone to code it up. What you are for is someone to spend their time to produce something for you for free. If someone has a similar use-case and wants to contribute to our repo a new advanced section of the tutorial, I am all down for that. But, typically, people contract out developers when they want something built that doesn't exist and they lack the coding ability to do so themselves.