From 1e92f296220980c6215ff6cd8863f12f7aa20512 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 25 Jun 2018 18:04:26 -0400 Subject: [PATCH] username now checked for validity --- src/larbs.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/larbs.sh b/src/larbs.sh index fffa10d..1772066 100755 --- a/src/larbs.sh +++ b/src/larbs.sh @@ -4,6 +4,12 @@ pacman -S --noconfirm --needed dialog || { echo "Error at script start: Are you dialog --title "Welcome!" --msgbox "Welcome to Luke's Auto-Rice Bootstrapping Script!\n\nThis script will automatically install a fully-featured i3wm Arch Linux desktop, which I use as my main machine.\n\n-Luke" 10 60 name=$(dialog --no-cancel --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) + +re="^[a-z_][a-z0-9_-]*$" +while ! [[ "${name}" =~ ${re} ]]; do + name=$(dialog --no-cancel --inputbox "Username not valid. Give a username beginning with a letter, with only lowercase letters, - and _." 10 60 3>&1 1>&2 2>&3 3>&1) +done + pass1=$(dialog --no-cancel --passwordbox "Enter a password for that user." 10 60 3>&1 1>&2 2>&3 3>&1) pass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)