mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #31161 from papoyan/develop
added a feature to hash a password if provided as clear text
This commit is contained in:
commit
e36a53e05e
@ -193,6 +193,7 @@ def present(name,
|
||||
home=None,
|
||||
createhome=True,
|
||||
password=None,
|
||||
hash_password=False,
|
||||
enforce_password=True,
|
||||
empty_password=False,
|
||||
shell=None,
|
||||
@ -270,6 +271,10 @@ def present(name,
|
||||
.. versionchanged:: 0.16.0
|
||||
BSD support added.
|
||||
|
||||
hash_password
|
||||
Set to True to hash the clear text password. Default is ``False``.
|
||||
|
||||
|
||||
enforce_password
|
||||
Set to False to keep the password from being changed if it has already
|
||||
been set and the password hash differs from what is specified in the
|
||||
@ -367,6 +372,14 @@ def present(name,
|
||||
|
||||
.. versionchanged:: 2015.8.0
|
||||
'''
|
||||
|
||||
# First check if a password is set. If password is set, check if
|
||||
# hash_password is True, then hash it.
|
||||
|
||||
if password and hash_password:
|
||||
log.debug('Hashing a clear text password')
|
||||
password = __salt__['shadow.gen_password'](password)
|
||||
|
||||
if fullname is not None:
|
||||
fullname = sdecode(fullname)
|
||||
if roomnumber is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user