1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
from services.users.models import UserProfile
PROTECTED_USERNAMES = [
"admin",
"administrator",
"root",
"thatcomputerscientist",
"skippy",
"system",
"superuser",
"sysadmin",
"sysadministrator",
"sysop",
"test",
"user",
"webmaster",
"www",
"postmaster",
"hostmaster",
"info",
"support",
"anonymous",
"guest",
"nobody",
"someone",
"moderator",
"moderators",
"mods",
"crvs",
]
def validate_auth_input(username, password, login=True):
valid = True
if not username or not password:
valid = False
if username == "" or password == "":
valid = False
if username in PROTECTED_USERNAMES and not login:
valid = False
return valid
def validate_verified_user_email(user):
try:
email_verified = UserProfile.objects.get(user=user).email_verified
except UserProfile.DoesNotExist:
email_verified = False
return email_verified
|