Browse Source

[Security] Replace timestamp-based password generation with random generator (#3571)

* Update x-ui.sh

* Update x-ui.sh

* Update x-ui.sh

* Update x-ui.sh
JieXu 11 hours ago
parent
commit
90c3529301
1 changed files with 2 additions and 2 deletions
  1. 2 2
      x-ui.sh

+ 2 - 2
x-ui.sh

@@ -189,9 +189,9 @@ reset_user() {
     fi
     fi
     
     
     read -rp "Please set the login username [default is a random username]: " config_account
     read -rp "Please set the login username [default is a random username]: " config_account
-    [[ -z $config_account ]] && config_account=$(date +%s%N | md5sum | cut -c 1-8)
+    [[ -z $config_account ]] && config_account=$(gen_random_string 10)
     read -rp "Please set the login password [default is a random password]: " config_password
     read -rp "Please set the login password [default is a random password]: " config_password
-    [[ -z $config_password ]] && config_password=$(date +%s%N | md5sum | cut -c 1-8)
+    [[ -z $config_password ]] && config_password=$(gen_random_string 18)
 
 
     read -rp "Do you want to disable currently configured two-factor authentication? (y/n): " twoFactorConfirm
     read -rp "Do you want to disable currently configured two-factor authentication? (y/n): " twoFactorConfirm
     if [[ $twoFactorConfirm != "y" && $twoFactorConfirm != "Y" ]]; then
     if [[ $twoFactorConfirm != "y" && $twoFactorConfirm != "Y" ]]; then