Fix secret length generation

This commit is contained in:
decentral1se 2021-05-14 16:07:46 +02:00
parent 2d6a08a671
commit 1b85bf3d37
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A

24
abra
View File

@ -1633,9 +1633,9 @@ POWERED BY
} }
sub_app_secret_generate(){ sub_app_secret_generate(){
SECRET="$abra__secret_" local secret="$abra__secret_"
VERSION="$abra__version_" local version="$abra__version_"
LENGTH="$abra__length_" local length="$abra__length_"
if [ "$abra___all" == "true" ]; then if [ "$abra___all" == "true" ]; then
# Note(decentral1se): we need to reset the flag here to avoid the infinite # Note(decentral1se): we need to reset the flag here to avoid the infinite
@ -1646,22 +1646,18 @@ sub_app_secret_generate(){
return return
fi fi
if [[ -n "$LENGTH" ]]; then if [[ -n "$length" ]]; then
if [ -z "$abra__cmd_" ]; then require_binary pwgen
require_binary pwgen abra__cmd_="pwgen -s $length 1"
abra__cmd_="pwgen -s $LENGTH 1"
fi
else else
if [ -z "$abra__cmd_" ]; then require_binary pwqgen
require_binary pwqgen abra__cmd_=pwqgen
abra__cmd_=pwqgen
fi
fi fi
PWGEN=${abra__cmd_}
PWGEN=${abra__cmd_}
debug "SECRET: $SECRET, VERSION $VERSION, PW $PWGEN, ALL $abra___all" debug "SECRET: $SECRET, VERSION $VERSION, PW $PWGEN, ALL $abra___all"
if [ -z "$SECRET" ] || [ -z "$VERSION" ] && [ "$abra___all" == "false" ]; then if [ -z "$secret" ] || [ -z "$version" ] && [ "$abra___all" == "false" ]; then
error "Required arguments missing" error "Required arguments missing"
fi fi