forked from github/server
Merge branch 'master' of https://github.com/ennorehling/eressea
This commit is contained in:
commit
3057031077
3 changed files with 13 additions and 2 deletions
|
@ -9,6 +9,11 @@ if len(sys.argv)<4:
|
|||
filename=sys.argv[1]
|
||||
myfaction=sys.argv[2]
|
||||
mypasswd=sys.argv[3]
|
||||
quiet=len(sys.argv)<=4
|
||||
|
||||
def log(str):
|
||||
if not quiet:
|
||||
print(str)
|
||||
|
||||
if mypasswd[0] == '"':
|
||||
mypasswd = mypasswd.strip('"')
|
||||
|
@ -16,10 +21,17 @@ if mypasswd[0] == '"':
|
|||
pw_data = EPasswd()
|
||||
try:
|
||||
pw_data.load_database(filename)
|
||||
log("loaded from db " + filename)
|
||||
except:
|
||||
pw_data.load_file(filename)
|
||||
log("loaded from file " + filename)
|
||||
|
||||
if pw_data.fac_exists(myfaction):
|
||||
if pw_data.check(myfaction, mypasswd):
|
||||
log("password match: " + myfaction)
|
||||
sys.exit(0)
|
||||
log("password mismatch: " + myfaction)
|
||||
else:
|
||||
log("faction missing: " + myfaction)
|
||||
|
||||
sys.exit(-1)
|
||||
|
|
|
@ -69,7 +69,7 @@ class EPasswd:
|
|||
def check(self, id, passwd):
|
||||
pw = self.get_passwd(id)
|
||||
if pw[0:4]=='$2a$' or pw[0:4]=='$2y$':
|
||||
return bcrypt.checkpw(passwd, pw)
|
||||
return bcrypt.checkpw(passwd.encode('utf8'), pw.encode('utf8'))
|
||||
return pw == passwd
|
||||
|
||||
def get_passwd(self, id):
|
||||
|
|
|
@ -2238,7 +2238,6 @@ static void eval_trail(struct opstack **stack, const void *userdata)
|
|||
handle_end = aregs->nregions;
|
||||
for (i = begin; i < handle_end; ++i) {
|
||||
region *r = aregs->regions[i];
|
||||
sbs_strcat(&sbs, ", ");
|
||||
|
||||
print_trail(report, r, lang, &sbs);
|
||||
|
||||
|
|
Loading…
Reference in a new issue