mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 05:44:08 -07:00
introducing vesta_generate_pass() function
This commit is contained in:
parent
79357d2077
commit
e5b3ef9b03
1 changed files with 14 additions and 0 deletions
14
func/main.sh
14
func/main.sh
|
@ -1057,3 +1057,17 @@ replace_php_config_value() {
|
|||
sed -i "s|=$1$|=$2|g" $3
|
||||
sed -i "s|= $1$|= $2|g" $3
|
||||
}
|
||||
|
||||
# Defining password-gen function
|
||||
vesta_generate_pass() {
|
||||
MATRIX='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
LENGTH=32
|
||||
if [ $# -gt 0 ] && [ $1 != "" ]; then
|
||||
LENGTH=$1
|
||||
fi
|
||||
while [ ${n:=1} -le $LENGTH ]; do
|
||||
PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"
|
||||
let n+=1
|
||||
done
|
||||
echo "$PASS"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue