From 64937fac3a7352f2b0128f30f3b32c6e7a498b8e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 11 Feb 2016 20:39:56 +0100 Subject: [PATCH] do all password checks with EPasswd --- process/checkpasswd.py | 18 +++++------------- process/orders-process | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/process/checkpasswd.py b/process/checkpasswd.py index 2aa51a109..f797dcfde 100755 --- a/process/checkpasswd.py +++ b/process/checkpasswd.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys, re +from epasswd import EPasswd if len(sys.argv)<4: sys.exit(-2) @@ -11,18 +12,9 @@ mypasswd=sys.argv[3] if mypasswd[0]=='"': mypasswd=mypasswd[1:len(mypasswd)-1] -try: - infile = open(passfile, "r") -except: - print "failed to open " + passfile - sys.exit(-1) -for line in infile.readlines(): - match = line.split(":") - if match!=None: - faction, passwd, override = match[0:3] - if faction==myfaction: - if passwd==mypasswd or override==mypasswd: - sys.exit(0) +pw_data=EPasswd(passfile) +if pw_data.fac_exists(myfaction): + if pw_data.check(myfaction, mypasswd): + sys.exit(0) sys.exit(-1) - diff --git a/process/orders-process b/process/orders-process index d15d188cf..a4d932648 100755 --- a/process/orders-process +++ b/process/orders-process @@ -87,7 +87,7 @@ def check_pwd(filename, email, pw_data): fact_nr = str(mo.group(2)) fact_pw = str(mo.group(3)) if pw_data.fac_exists(fact_nr): - if pw_data.check(fact_nr, fact_pw) == 0: + if not pw_data.check(fact_nr, fact_pw): game_email = pw_data.get_email(fact_nr) results = results + [ (fact_nr, game_email, False, fact_pw) ] else: