diff --git a/wordle b/wordle index e2003fe..db6ec40 100755 --- a/wordle +++ b/wordle @@ -140,9 +140,15 @@ function set_options() { echo -en "${CLEAR_SCREEN}" declare -g USER - read -r -p "Username: " USER + read -r -p "Username: " USER || exit 1 USER="${USER,,}" + # Username is used in file names and URLs so only allow safe characters + while [[ -z "${USER}" || "${USER}" == *[!a-z0-9_]* || ${#USER} -gt 32 ]]; do + read -r -p "${CLEAR_UP1}Username (letters, numbers and _ only): " USER || exit 1 + USER="${USER,,}" + done + declare -g DAY DAY=$(( EPOCHSECONDS / 86400 ))