Generate temporary password in adduser
This commit is contained in:
parent
ee81994947
commit
d619b166be
14
adduser
14
adduser
|
@ -2,10 +2,11 @@
|
|||
|
||||
# A wrapper script over ldapadd
|
||||
|
||||
from sys import argv
|
||||
from os import remove
|
||||
from subprocess import run, call, check_output
|
||||
from crypt import crypt
|
||||
from os import remove
|
||||
from secrets import token_urlsafe
|
||||
from subprocess import run, call, check_output
|
||||
from sys import argv
|
||||
|
||||
|
||||
def configure(username):
|
||||
|
@ -65,7 +66,12 @@ gidNumber: {uid}'''
|
|||
if ret != 0:
|
||||
return
|
||||
|
||||
# Configure and set up user
|
||||
configure(username)
|
||||
|
||||
|
||||
adduser(*[argv[i] for i in range(1, 6)])
|
||||
# Generate temporary password
|
||||
password = token_urlsafe(6)
|
||||
print('Temporary password:', password)
|
||||
|
||||
adduser(*[argv[i] for i in range(1, 5)], password)
|
||||
|
|
Loading…
Reference in a new issue