Fix in change password
This commit is contained in:
parent
ad6fb7e28f
commit
023ae57225
1 changed files with 4 additions and 0 deletions
|
|
@ -32,6 +32,8 @@ def add_user(user, password='', group='', user_directory='', shell='/usr/sbin/no
|
||||||
|
|
||||||
if group!='':
|
if group!='':
|
||||||
|
|
||||||
|
# Buggy, need fix.
|
||||||
|
|
||||||
stat_group=os.stat('/home/%s' % user_directory)
|
stat_group=os.stat('/home/%s' % user_directory)
|
||||||
gid=stat_group.st_gid
|
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:
|
if call("sudo echo \"%s:%s\" | chpasswd" % (user, new_password), shell=True, stdout=DEVNULL) > 0:
|
||||||
|
|
||||||
return (True, 'Change password successfully')
|
return (True, 'Change password successfully')
|
||||||
|
else:
|
||||||
|
return (False, 'I cannot change password')
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue