Fix crash when enter characters on password generator
This commit is contained in:
parent
3056dc35ad
commit
d6ef9e7956
|
@ -109,10 +109,19 @@ function vault_key_decrypt() {
|
||||||
function generate_password() {
|
function generate_password() {
|
||||||
if [ -z "${1}" ] ; then
|
if [ -z "${1}" ] ; then
|
||||||
default_long_password=20
|
default_long_password=20
|
||||||
elif [ ${1} -lt 8 ] ; then
|
else
|
||||||
|
expr ${1} + 1 &> /dev/null
|
||||||
|
num_error=$?
|
||||||
|
if [ ${num_error} -ne 0 ] ; then
|
||||||
|
size_pass=20
|
||||||
|
else
|
||||||
|
size_pass="${1}"
|
||||||
|
fi
|
||||||
|
# Create password
|
||||||
|
if [ ${size_pass} -lt 8 ] ; then
|
||||||
default_long_password=10
|
default_long_password=10
|
||||||
else
|
else
|
||||||
default_long_password=${1}
|
default_long_password=${size_pass}
|
||||||
fi
|
fi
|
||||||
count_char_password=1
|
count_char_password=1
|
||||||
current_password=""
|
current_password=""
|
||||||
|
@ -129,6 +138,7 @@ function generate_password() {
|
||||||
if [ "${2}" != "param" ] ; then
|
if [ "${2}" != "param" ] ; then
|
||||||
echo -n "# Press enter key to continue " ; read enter_continue
|
echo -n "# Press enter key to continue " ; read enter_continue
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_password_menu() {
|
function generate_password_menu() {
|
||||||
|
|
|
@ -120,10 +120,19 @@ function vault_key_decrypt() {
|
||||||
function generate_password() {
|
function generate_password() {
|
||||||
if [ -z "${1}" ] ; then
|
if [ -z "${1}" ] ; then
|
||||||
default_long_password=20
|
default_long_password=20
|
||||||
elif [ ${1} -lt 8 ] ; then
|
else
|
||||||
|
expr ${1} + 1 &> /dev/null
|
||||||
|
num_error=$?
|
||||||
|
if [ ${num_error} -ne 0 ] ; then
|
||||||
|
size_pass=20
|
||||||
|
else
|
||||||
|
size_pass="${1}"
|
||||||
|
fi
|
||||||
|
# Create password
|
||||||
|
if [ ${size_pass} -lt 8 ] ; then
|
||||||
default_long_password=10
|
default_long_password=10
|
||||||
else
|
else
|
||||||
default_long_password=${1}
|
default_long_password=${size_pass}
|
||||||
fi
|
fi
|
||||||
count_char_password=1
|
count_char_password=1
|
||||||
current_password=""
|
current_password=""
|
||||||
|
@ -140,15 +149,25 @@ function generate_password() {
|
||||||
if [ "${2}" != "param" ] ; then
|
if [ "${2}" != "param" ] ; then
|
||||||
echo -n "# Press enter key to continue " ; read enter_continue
|
echo -n "# Press enter key to continue " ; read enter_continue
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function gen_password_dl() {
|
function gen_password_dl() {
|
||||||
if [ -z "${1}" ] ; then
|
if [ -z "${1}" ] ; then
|
||||||
default_long_password=20
|
default_long_password=20
|
||||||
elif [ ${1} -lt 8 ] ; then
|
else
|
||||||
|
expr ${1} + 1 &> /dev/null
|
||||||
|
num_error=$?
|
||||||
|
if [ ${num_error} -ne 0 ] ; then
|
||||||
|
size_pass=20
|
||||||
|
else
|
||||||
|
size_pass="${1}"
|
||||||
|
fi
|
||||||
|
# Create password
|
||||||
|
if [ ${size_pass} -lt 8 ] ; then
|
||||||
default_long_password=10
|
default_long_password=10
|
||||||
else
|
else
|
||||||
default_long_password=${1}
|
default_long_password=${size_pass}
|
||||||
fi
|
fi
|
||||||
count_char_password=1
|
count_char_password=1
|
||||||
current_password=""
|
current_password=""
|
||||||
|
@ -158,6 +177,7 @@ function gen_password_dl() {
|
||||||
count_char_password=$(expr ${count_char_password} + 1)
|
count_char_password=$(expr ${count_char_password} + 1)
|
||||||
done
|
done
|
||||||
echo "${current_password}"
|
echo "${current_password}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_password_menu() {
|
function generate_password_menu() {
|
||||||
|
|
|
@ -155,10 +155,19 @@ function vault_key_decrypt() {
|
||||||
function generate_password() {
|
function generate_password() {
|
||||||
if [ -z "${1}" ] ; then
|
if [ -z "${1}" ] ; then
|
||||||
default_long_password=20
|
default_long_password=20
|
||||||
elif [ ${1} -lt 8 ] ; then
|
else
|
||||||
|
expr ${1} + 1 &> /dev/null
|
||||||
|
num_error=$?
|
||||||
|
if [ ${num_error} -ne 0 ] ; then
|
||||||
|
size_pass=20
|
||||||
|
else
|
||||||
|
size_pass="${1}"
|
||||||
|
fi
|
||||||
|
# Create password
|
||||||
|
if [ ${size_pass} -lt 8 ] ; then
|
||||||
default_long_password=10
|
default_long_password=10
|
||||||
else
|
else
|
||||||
default_long_password=${1}
|
default_long_password=${size_pass}
|
||||||
fi
|
fi
|
||||||
count_char_password=1
|
count_char_password=1
|
||||||
current_password=""
|
current_password=""
|
||||||
|
@ -175,17 +184,25 @@ function generate_password() {
|
||||||
if [ "${2}" != "param" ] ; then
|
if [ "${2}" != "param" ] ; then
|
||||||
echo -n "# Press enter key to continue " ; read enter_continue
|
echo -n "# Press enter key to continue " ; read enter_continue
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_password_gui() {
|
function generate_password_gui() {
|
||||||
if [ -z "${1}" ] ; then
|
if [ -z "${1}" ] ; then
|
||||||
default_long_password=20
|
default_long_password=20
|
||||||
elif [ ${1} -lt 8 ] ; then
|
|
||||||
default_long_password=10
|
|
||||||
elif [ ${1} -gt 30 ] ; then
|
|
||||||
default_long_password=30
|
|
||||||
else
|
else
|
||||||
default_long_password=${1}
|
expr ${1} + 1 &> /dev/null
|
||||||
|
num_error=$?
|
||||||
|
if [ ${num_error} -ne 0 ] ; then
|
||||||
|
size_pass=20
|
||||||
|
else
|
||||||
|
size_pass="${1}"
|
||||||
|
fi
|
||||||
|
# Create password
|
||||||
|
if [ ${size_pass} -lt 8 ] ; then
|
||||||
|
default_long_password=10
|
||||||
|
else
|
||||||
|
default_long_password=${size_pass}
|
||||||
fi
|
fi
|
||||||
count_char_password=1
|
count_char_password=1
|
||||||
current_password=""
|
current_password=""
|
||||||
|
@ -199,6 +216,7 @@ function generate_password_gui() {
|
||||||
echo ${current_password} >> ${pwsh_vault_password_copy}
|
echo ${current_password} >> ${pwsh_vault_password_copy}
|
||||||
echo > /dev/null | pwsh-vaultm -p " PASSWORD: ${current_password} $(generate_spaces 65)"
|
echo > /dev/null | pwsh-vaultm -p " PASSWORD: ${current_password} $(generate_spaces 65)"
|
||||||
echo > /dev/null | pwsh-vaultm -p " Password has been copied to ${pwsh_vault_password_copy} $(generate_spaces 20)"
|
echo > /dev/null | pwsh-vaultm -p " Password has been copied to ${pwsh_vault_password_copy} $(generate_spaces 20)"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_password_menu() {
|
function generate_password_menu() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user