ignore mal-formed input lines
sort usernames by default
This commit is contained in:
parent
ea8a8d8d80
commit
f611eac8ad
1 changed files with 6 additions and 3 deletions
|
@ -55,6 +55,7 @@ class HtpasswdFile:
|
|||
"""
|
||||
self.entries = {}
|
||||
for line in open(self.filename, 'r').readlines():
|
||||
if ":" in line:
|
||||
username, pwhash = line.split(':', 1)
|
||||
self.entries[username] = pwhash
|
||||
|
||||
|
@ -96,5 +97,7 @@ class HtpasswdFile:
|
|||
self.entries.pop(username)
|
||||
|
||||
def get_usernames(self):
|
||||
return self.entries.keys()
|
||||
names = self.entries.keys()
|
||||
names.sort()
|
||||
return names
|
||||
|
||||
|
|
Loading…
Reference in a new issue