فهرست منبع

Merge pull request #1005 from Lupul/feature-987

Passwords can be supplied also interactive or piped now (in addition …
Kristan Kenney 5 سال پیش
والد
کامیت
d76f03a7ee
1فایلهای تغییر یافته به همراه8 افزوده شده و 1 حذف شده
  1. 8 1
      bin/v-change-user-password

+ 8 - 1
bin/v-change-user-password

@@ -25,10 +25,17 @@ source $HESTIA/conf/hestia.conf
 #                    Verifications                         #
 #                    Verifications                         #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-check_args '2' "$#" 'USER PASSWORD'
+check_args '1' "$#" 'USER [PASSWORD]'
 is_format_valid 'user'
 is_format_valid 'user'
 is_object_valid 'user' 'USER' "$user"
 is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
+
+# Non-interactive (stdin not opened)
+[[ -z "$password" && ! -t 0 ]] && read -r password
+
+# Password prompt
+[[ -z "$password" ]] && read -r -s -p "Password:" password
+
 is_password_valid
 is_password_valid
 
 
 # Perform verification if read-only mode is enabled
 # Perform verification if read-only mode is enabled