do all password checks with EPasswd

This commit is contained in:
Enno Rehling 2016-02-11 20:39:56 +01:00
parent 57ae38dec5
commit 64937fac3a
2 changed files with 6 additions and 14 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys, re import sys, re
from epasswd import EPasswd
if len(sys.argv)<4: if len(sys.argv)<4:
sys.exit(-2) sys.exit(-2)
@ -11,18 +12,9 @@ mypasswd=sys.argv[3]
if mypasswd[0]=='"': if mypasswd[0]=='"':
mypasswd=mypasswd[1:len(mypasswd)-1] 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(): pw_data=EPasswd(passfile)
match = line.split(":") if pw_data.fac_exists(myfaction):
if match!=None: if pw_data.check(myfaction, mypasswd):
faction, passwd, override = match[0:3]
if faction==myfaction:
if passwd==mypasswd or override==mypasswd:
sys.exit(0) sys.exit(0)
sys.exit(-1) sys.exit(-1)

View File

@ -87,7 +87,7 @@ def check_pwd(filename, email, pw_data):
fact_nr = str(mo.group(2)) fact_nr = str(mo.group(2))
fact_pw = str(mo.group(3)) fact_pw = str(mo.group(3))
if pw_data.fac_exists(fact_nr): 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) game_email = pw_data.get_email(fact_nr)
results = results + [ (fact_nr, game_email, False, fact_pw) ] results = results + [ (fact_nr, game_email, False, fact_pw) ]
else: else: