CHANGE: New user signups now require admin approval

Given that I intend to reveal much more data to new users this seems necessary...
This commit is contained in:
2020-01-11 18:18:08 +00:00
parent 68af9c8779
commit 479977ef58
6 changed files with 40 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ from django.conf import settings
from django.core import serializers
from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AuthenticationForm, PasswordResetForm
from registration.forms import RegistrationFormUniqueEmail
from django.contrib.auth.forms import AuthenticationForm
from captcha.fields import ReCaptchaField
import simplejson
@@ -54,6 +55,13 @@ class ProfileChangeForm(UserChangeForm):
model = models.Profile
class CheckApprovedForm(AuthenticationForm):
def confirm_login_allowed(self, user):
if not user.is_approved:
raise forms.ValidationError("Your account hasn't been approved by an administrator yet. Please check back in a few minutes!")
return AuthenticationForm.confirm_login_allowed(self, user)
# Events Shit
class EventForm(forms.ModelForm):
datetime_input_formats = formats.get_format_lazy("DATETIME_INPUT_FORMATS") + list(settings.DATETIME_INPUT_FORMATS)