Skip to content

JasonEtco/craft-emailwhitelist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Email Whitelist

A plugin for Craft CMS that prevents new users from signing up unless their email is from a specific domain.

Installation

  1. Move emailwhitelist directory to craft/plugins directory
  2. Install Email Whitelist under Craft Admin β€Ί Settings β€Ί Plugins

Usage

In the settings page for Email Whitelist, simply add a new row and type the text that any new user's email must have. The plugin will check each item in the list.

There is also a toggle to enable Blacklist Mode, which disallows whatever emails you've put in the list.

Screenshot of EmailWhitelist

Do you also have client-side validation? Great! In a template, you can get the list of allowed emails to throw into a <script> tag:

{% for email in craft.emailWhitelist.getEmails() %}
  {{ email[0] }}
{% endfor %}

On error, the plugin sets a flash message which you can see in a template:

{% if craft.session.hasFlash('emailwhitelist') %}
  <h1>{{ craft.session.getFlash('emailwhitelist') }}</h1>
{% endif %}

That's all there is to it!

Changelog

  • 1.1.0 : Add Blacklist mode, with a toggle on the plugin's Settings page, changed variable names
  • 1.0.0 : Initial Version

Feedback?

Please submit an issue or reach out to me on Twitter: @jasonetco

License

MIT Β© Jason Etcovitch

About

πŸ”’βœ‰ A whitelist of emails for Craft

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published