Hello!
I’m not sure if there is someone who would be able to give me some direction on how to create this.
I’m looking to have a website that when first accessed shows a “password” page. People who will be accessing this page will have the direct link. They will have a code that will be given to them prior to and this will give them access to the secondary page - which should not be accessed other than with that code. So I want to make sure that if someone tried to copy and paste the second page, they would be redirected.
Is there a way to connect a dataset or something of the like that allows the person with their unique code to login - but if someone doesn’t have a password on the list - it will not grant them access to the store.
At this point - there will be 2,000 codes that will be give out, but I will not have their names/emails just the codes that I have predesignated.
Hi - yes I do no want the person to register. Yes, I believe that is correct, as long as the person has that information they are able to see the pages that we grant the access to.
It’s a little bit omplicated. You may need to read more in the API docs.
You can do something like that:
Create a data collection with the following fields: urlIdentfier , password , tempPass (all type: string)
In the url Identifier put any unique string that should appear in the unique url.
(alternatively you can use the auto-generated _id value instead)
Add the password to the password field.
Leave the tempPass empty.
Create the page with the password input (and “Continue” button).
Create a second ROUTER page (where your contents are)
Once the uer reaches this page -
Use wixLocation.query to extract the identifier from the url.
Once the user fills in the password and clicks ‘continue’, query the database to see if they match.
If they do, create a random temporary password and save to the database.
after saving, move to the second page like this:
In the backend/router.js file
Add a beforeRouter function.
run a query to check if the tempPass matches the urlIdentfier AND the current page is less than let’s say 1 minute from the record _updatedTime
If it is - next(); if it not - forbidden();
Alternatively (easier, less secured in some aspect).
Create only one page.
Put a top layer box with the password input.
Run a query to compare the urlIdentfier to the filled-in password.
If they match - collapse the top layer, and run the data query you need to get the data you wish to display.