How to Restrict Your Webflow Website Login to “Allowed” Emails Only

Michelle Marcelline
Cotter
Published in
4 min readAug 25, 2020

Grant access to your Webflow website waitlist on a rolling basis. Try it!

Prerequisites

Before we begin, make sure you have done the following:

How it works

We’ll have 3 pages in this tutorial: A Waitlist Page (/waitlist), a Login Page (/), and a Protected Page (/protected).

Users can sign up to the waitlist by entering their email on the Waitlist Page. You can manage people on the waitlist in your Google Sheets. Only people who are marked as Allowed: TRUE on the waitlist can login to your website using the Login Page and access the Protected Page.

In this tutorial, we’ll make the Waitlist Page, and then update the Login and Protected Page that you have made in the prerequisite tutorial.

Inserting Waitlist Emails to Google Sheets

Make a Waitlist Page

Step 1: Set up Google Sheets

Go to https://cotteremaillist.herokuapp.com to connect your Google Sheets that contains a list of emails and follow the instructions there. See an example Google Sheet here. (You can make this sheet private — you just need to connect your Google Account in the website above).

Step 2: Make elements to show the waitlist email form and a success message

  • Include a section element to load Cotter’s login form. We need to set that section id “cotter-form-container”
  • Include a text element with id “waitlist-message”. We will show if the email is successfully added to the waitlist here.

Step 3: Add Cotter JS SDK

After finishing the page setup we can start with adding custom code to the Waitlist Page. Copy paste the code below to the custom code tab on the Waitlist Page settings.

Waitlist Page Settings
Scroll Down to “Custom Code” section

Add the code below to the head of Waitlist page:

Step 4: Add a function to insert email to your Google Sheets

Make sure you have already done Step 1 by going to https://cotteremaillist.herokuapp.com and connecting your Google Sheets that contains the waitlist (this can be empty, but make sure you follow the format specified).

Add the code below to the body of Waitlist page:

Make sure that you have pasted your Spreadsheet ID and your API Key ID on the code block above.

You can grab a Cotter API Key ID by visiting https://dev.cotter.app and creating an account. Once you have created an account, make sure to create a new project and grab the API Key ID.

Step 5: Add the code below to show the email form (“Join Waitlist” form)

Below the code on step 4, add this code:

Make sure that you have pasted your API Key ID on the code block above.

Login Page Setup (where the login form will show up)

Login Page Setup (where the login form will show up)

You should already have a Login Page after following the prerequisite tutorial above. Only users who are allowed in your Google Sheets can login. We are going to modify and add some of the necessary code.

Step 1. Add the code below to the body of the Login Page

Add this code before you Initialize Cotter

Make sure that you have pasted your Spreadsheet ID and your API Key ID on the code block above.

Step 2. Change the code in the body of the Login Page to the code below

Make sure you deleted the line “.signInWithLink()” and added the line “.signInWithLink(checkEmail)”.

Also, make sure that you have pasted your API Key ID on the code block above.

Protected Page Setup (and any other page you want to protect)

You should already have a Protected Page after following the prerequisite tutorial above. We are going to modify and add some of the necessary code.

Change the code on the header to the code below

Make sure you delete all lines with the “-” symbol and added all lines with the “+” symbol. (Do not include the + sign itself).

Also, make sure that you have pasted your Spreadsheet ID and your API Key ID on the code block above.

Questions & Feedback

Come and talk to the founders of Cotter and other developers who are using Cotter on Cotter’s Slack Channel.

Ready to use Cotter?

If you enjoyed this tutorial and want to integrate Cotter into your website or app, you can create a free account and check out our documentation.

If you need help, ping us on our Slack channel or email us at team@cotter.app.

Originally published at https://blog.cotter.app on August 25, 2020.

--

--

Michelle Marcelline
Cotter
Editor for

Sharing my journey, learnings, successes, and failures building Typedream.com (Notion-like NoCode website builder)