Fix in change password

This commit is contained in:
absurdo 2023-05-26 01:07:18 +02:00
parent ad6fb7e28f
commit 023ae57225

View file

@ -32,6 +32,8 @@ def add_user(user, password='', group='', user_directory='', shell='/usr/sbin/no
if group!='':
# Buggy, need fix.
stat_group=os.stat('/home/%s' % user_directory)
gid=stat_group.st_gid
@ -57,6 +59,8 @@ def change_password(user, new_password):
if call("sudo echo \"%s:%s\" | chpasswd" % (user, new_password), shell=True, stdout=DEVNULL) > 0:
return (True, 'Change password successfully')
else:
return (False, 'I cannot change password')
except KeyError: