diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-07-02 12:25:25 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-02 12:25:25 +0300 |
| commit | 5d11e6e13f7254a72874dabee6c1cf4e81f5ec52 (patch) | |
| tree | 3e255de35ef4f9f4cb79daabaa7a696f10263dc1 /x-ui.sh | |
| parent | f3d0b92e4ab2737f96fea3d0f567fdc040c21acb (diff) | |
chore: reset two-factor authentication after changing admin credentials (#3029)
* chore: add `resetTwoFactor` argument for main.go
fixes #3025
* chore: reset two-factor authentication after changing admin credentials
* chore: reset two-factor authentication after changing admin credentials
---------
Co-authored-by: somebodywashere <68244480+somebodywashere@users.noreply.github.com>
Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
Diffstat (limited to 'x-ui.sh')
| -rw-r--r-- | x-ui.sh | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -179,11 +179,20 @@ reset_user() { fi return 0 fi + 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) 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) - /usr/local/x-ui/x-ui setting -username ${config_account} -password ${config_password} >/dev/null 2>&1 + + read -rp "Do you want to disable currently configured two-factor authentication? (y/n): " twoFactorConfirm + if [[ $twoFactorConfirm != "y" && $twoFactorConfirm != "Y" ]]; then + /usr/local/x-ui/x-ui setting -username ${config_account} -password ${config_password} -resetTwoFactor false >/dev/null 2>&1 + else + /usr/local/x-ui/x-ui setting -username ${config_account} -password ${config_password} -resetTwoFactor true >/dev/null 2>&1 + echo -e "Two factor authentication has been disabled." + fi + echo -e "Panel login username has been reset to: ${green} ${config_account} ${plain}" echo -e "Panel login password has been reset to: ${green} ${config_password} ${plain}" echo -e "${green} Please use the new login username and password to access the X-UI panel. Also remember them! ${plain}" |
