From f0860b77c78c9889bcbd6d6b88c81e3fc66ae193 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Mon, 13 May 2019 13:48:39 -0400 Subject: add support for user filtering --- app/auth/forms.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/auth') diff --git a/app/auth/forms.py b/app/auth/forms.py index 8f7662a..06bad3f 100644 --- a/app/auth/forms.py +++ b/app/auth/forms.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from flask import current_app from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField @@ -37,6 +38,19 @@ class RegistrationForm(FlaskForm): raise ValidationError( "Email address already in use, please use a different one." ) + if current_app.config["USER_EMAILS"]: + if email.data in current_app.config["USER_EMAILS"]: + return + if current_app.config["USER_EMAIL_DOMAINS"]: + if not email.data in current_app.config["USER_EMAIL_DOMAINS"]: + raise ValidationError( + "Access to AnnotateChange is restricted to " + "individuals with email addresses from specific " + "institutions. Please use your employee email address " + "when signing up. If that does not solve the issue, " + "you unfortunately do not have access to " + "AnnotateChange at this time." + ) class ResetPasswordRequestForm(FlaskForm): -- cgit v1.2.3