Restrict your Weebly site login to allowed Emails in Google Sheets
Only allow certain emails to log in to your Weebly site.
Prerequisites
- Cotter account.
- Google Sheet that contains a list of emails allowed to login. Your Google Sheet format should look like this:
You can duplicate this sheet from this link.
Step 1: Setup your form
- Go to Cotter dashboard and create a new form.
- Go to the Rules tab and connect your Google Account. You will be redirected back to Cotter once you’ve completed the process.
- Fill out the rest of the form.
Step 1: Setup your Weebly site
In this section, you will be setting up your Weebly site to use Cotter’s form to only allow specified user to enter your website.
First, you’ll need to add Cotter into your header code. Go to editing mode on your site, then go to Pages > Home (your login page) > SEO Settings.
Then copy and paste the following code to the section called HEADER CODE.
<script src="https://unpkg.com/cotter@0.3.31/dist/cotter.loader.js"
type="text/javascript"
data-cotter-api-key-id="<YOUR-API-KEY>"
></script>
You should have something like the following:
Step 2: Connect Cotter to your button on Weebly
In this section, we will tell Cotter which button on our website starts the authentication flow.
First, go to Cotter’s dashboard > Projects > Form & Fields, then press the copy icon in the Login Link popup.
This button simply copies a link (path parameter) to your clipboard. All you need to do is paste this into the button’s link. However, you have to know what the domain of your website will be — paste the link alongside your domain. In my case, it is https://mydomain.weebly.com/#/ct/login/form_default
You’re done 🎉
You can save the project and publish it. You should be able to restrict people from logging in using your form.
What’s next?
We’ve seen from the tutorial above how to prevent people from logging into your site by restricting who can use your form. Next you should: Restrict some users from accessing some pages in your app.