Skip to content

Commit ed0b008

Browse files
committed
Passwords can be supplied also interactive or piped now (in addition to existing methods: as arg or tmp file)
Closes 987
1 parent 0ac4911 commit ed0b008

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bin/v-change-user-password

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ source $HESTIA/conf/hestia.conf
2525
# Verifications #
2626
#----------------------------------------------------------#
2727

28-
check_args '2' "$#" 'USER PASSWORD'
28+
check_args '1' "$#" 'USER [PASSWORD]'
2929
is_format_valid 'user'
3030
is_object_valid 'user' 'USER' "$user"
3131
is_object_unsuspended 'user' 'USER' "$user"
32+
33+
# Non-interactive (stdin not opened)
34+
[[ -z "$password" && ! -t 0 ]] && read -r password
35+
36+
# Password prompt
37+
[[ -z "$password" ]] && read -r -s -p "Password:" password
38+
3239
is_password_valid
3340

3441
# Perform verification if read-only mode is enabled

0 commit comments

Comments
 (0)