Skip to content

Commit

Permalink
Merge branch 'master' into requires-io-master
Browse files Browse the repository at this point in the history
  • Loading branch information
plajjan authored Jun 21, 2016
2 parents e6e235f + 24433e9 commit 0204081
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nipap/nipap-passwd
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if __name__ == '__main__':
print "The user %s does not exist" % args.user
sys.exit(2)
af = nipap.authlib.AuthFactory()
auth = af.get_auth(options.username, options.password, "nipap", {})
auth = af.get_auth(args.user, args.password, "nipap", {})
if not auth.authenticate():
print "The password seems to be wrong"
sys.exit(2)
Expand Down
7 changes: 7 additions & 0 deletions nipap/nipap/authlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,13 @@ def modify_user(self, username, data):
Since username is used as primary key and we only have a single
argument for it we can't modify the username right now.
"""
if 'password' in data:
# generate salt
char_set = string.ascii_letters + string.digits
data['pwd_salt'] = ''.join(random.choice(char_set) for x in range(8))
data['pwd_hash'] = self._gen_hash(data['password'], data['pwd_salt'])
del(data['password'])

sql = "UPDATE user SET "
sql += ', '.join("%s = ?" % k for k in sorted(data))
sql += " WHERE username = ?"
Expand Down

0 comments on commit 0204081

Please sign in to comment.