Fix output for usernames with spaces

This commit is contained in:
12pm 2018-11-10 13:52:13 +01:00
parent 69b25b8f4c
commit 59334a7068

View file

@ -21,6 +21,8 @@ def auth_add_p_line(username, level, pwhash, salt):
print("Warning: level ({}) contains weird symbols, config line is possibly malformed.".format(level), file=sys.stderr) print("Warning: level ({}) contains weird symbols, config line is possibly malformed.".format(level), file=sys.stderr)
if repr(username) != "'{}'".format(username): if repr(username) != "'{}'".format(username):
print("Warning: username ({}) contains weird symbols, config line is possibly malformed.".format(username), file=sys.stderr) print("Warning: username ({}) contains weird symbols, config line is possibly malformed.".format(username), file=sys.stderr)
if ' ' in username:
username = '"{}"'.format(username)
return "auth_add_p {} {} {} {}".format(username, level, pwhash, salt) return "auth_add_p {} {} {} {}".format(username, level, pwhash, salt)
def auth_add_p_line_from_pw(username, level, password): def auth_add_p_line_from_pw(username, level, password):