As each year comes with a new CSV with different column order, place columns in variables
This commit is contained in:
parent
d1a3188ed4
commit
1d7241e3e3
11
login.py
11
login.py
@ -3,6 +3,11 @@ from email.utils import parseaddr
|
||||
|
||||
from test import MailTest
|
||||
|
||||
LASTNAME_FIELD = 0
|
||||
FIRSTNAME_FIELD = 1
|
||||
LOGIN_FIELD = 2
|
||||
EMAILADDR_FIELD = 3
|
||||
|
||||
|
||||
def check(cnt, file):
|
||||
data, uname = cnt
|
||||
@ -11,9 +16,9 @@ def check(cnt, file):
|
||||
with open(file, encoding='utf-8') as fd:
|
||||
people = csv.reader(fd)
|
||||
for p in people:
|
||||
if address.lower() == p[4].lower() or uname.lower().find(p[2].lower()) >= 0 or username.lower().replace(" ", "").find(p[0].lower().replace(" ", "")) >= 0 and username.lower().find(p[1].lower()) >= 0:
|
||||
yield MailTest("Recognized as %s: %s %s." % (p[2], p[1], p[0]))
|
||||
yield data, p[2]
|
||||
if address.lower() == p[EMAILADDR_FIELD].lower() or uname.lower().find(p[LOGIN_FIELD].lower()) >= 0 or username.lower().replace(" ", "").find(p[LASTNAME_FIELD].lower().replace(" ", "")) >= 0 and username.lower().find(p[FIRSTNAME_FIELD].lower()) >= 0:
|
||||
yield MailTest("Recognized as %s: %s %s." % (p[LOGIN_FIELD], p[FIRSTNAME_FIELD], p[LASTNAME_FIELD]))
|
||||
yield data, p[LOGIN_FIELD]
|
||||
return
|
||||
|
||||
yield MailTest("The username of your key is not explicit, I can't find you.", 1)
|
||||
|
Reference in New Issue
Block a user