fix bcrypt use

This commit is contained in:
Enno Rehling 2019-03-01 19:14:09 +01:00 committed by Enno Rehling
parent f5a03d4501
commit 9210f77a1a
2 changed files with 4 additions and 4 deletions

View File

@ -70,9 +70,9 @@ class EPasswd:
pw = self.get_passwd(id) pw = self.get_passwd(id)
if pw[0:4]=='$2a$' or pw[0:4]=='$2y$': if pw[0:4]=='$2a$' or pw[0:4]=='$2y$':
try: try:
h1 = pw.encode('utf8') uhash = pw.encode('utf8')
h2 = passwd.encode('utf8') upass = passwd.encode('utf8')
return bcrypt.checkpw(h1, h2) return bcrypt.checkpw(upass, uhash)
except: except:
return False return False
return pw == passwd return pw == passwd

View File

@ -1606,7 +1606,7 @@ int write_reports(faction * f)
if (f->lastorders == 0 || f->age <= 1) { if (f->lastorders == 0 || f->age <= 1) {
/* neue Parteien, oder solche die noch NIE einen Zug gemacht haben, /* neue Parteien, oder solche die noch NIE einen Zug gemacht haben,
* kriegen ein neues Passwort: */ * kriegen ein neues Passwort: */
password = faction_genpassword(f); password = faction_genpassword(f, buffer);
} }
prepare_report(&ctx, f, password); prepare_report(&ctx, f, password);
get_addresses(&ctx); get_addresses(&ctx);