Allow only aphanum chars in user-entered passwords
Fixes bug 885345 Change-Id: Ib41319676d2fd24144a1493bd58543ad71eb8d6c
This commit is contained in:
parent
52e631d8aa
commit
4e6a2b71e3
15
stack.sh
15
stack.sh
@ -244,12 +244,17 @@ function read_password {
|
|||||||
echo '################################################################################'
|
echo '################################################################################'
|
||||||
echo $msg
|
echo $msg
|
||||||
echo '################################################################################'
|
echo '################################################################################'
|
||||||
echo "This value will be written to your localrc file so you don't have to enter it again."
|
echo "This value will be written to your localrc file so you don't have to enter it "
|
||||||
echo "It is probably best to avoid spaces and weird characters."
|
echo "again. Use only alphanumeric characters."
|
||||||
echo "If you leave this blank, a random default value will be used."
|
echo "If you leave this blank, a random default value will be used."
|
||||||
echo "Enter a password now:"
|
pw=" "
|
||||||
read -e $var
|
while true; do
|
||||||
pw=${!var}
|
echo "Enter a password now:"
|
||||||
|
read -e $var
|
||||||
|
pw=${!var}
|
||||||
|
[[ "$pw" = "`echo $pw | tr -cd [:alnum:]`" ]] && break
|
||||||
|
echo "Invalid chars in password. Try again:"
|
||||||
|
done
|
||||||
if [ ! $pw ]; then
|
if [ ! $pw ]; then
|
||||||
pw=`openssl rand -hex 10`
|
pw=`openssl rand -hex 10`
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user