Handle long keyid

This commit is contained in:
nemunaire 2021-09-19 15:42:22 +02:00
parent 7002341583
commit 5d2d4ff451

View File

@ -9,16 +9,17 @@ LOGIN_FIELD = 2
EMAILADDR_FIELD = 3 EMAILADDR_FIELD = 3
def check(cnt, file): def check(cnt, *files):
data, uname = cnt data, uname = cnt
username, address = parseaddr(uname) username, address = parseaddr(uname)
with open(file, encoding='utf-8') as fd: for file in files:
people = csv.reader(fd) with open(file, encoding='utf-8') as fd:
for p in people: people = csv.reader(fd)
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: for p in people:
yield MailTest("Recognized as %s: %s %s." % (p[LOGIN_FIELD], p[FIRSTNAME_FIELD], p[LASTNAME_FIELD])) 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 data, p[LOGIN_FIELD] yield MailTest("Recognized as %s: %s %s." % (p[LOGIN_FIELD], p[FIRSTNAME_FIELD], p[LASTNAME_FIELD]))
return yield data, p[LOGIN_FIELD]
return
yield MailTest("The username of your key is not explicit, I can't find you.", 1) yield MailTest("The username of your key is not explicit, I can't find you.", 1)