Преглед изворни кода

Merge pull request #26 from KevCui/master

Fix -g error when email address having a digit before @
Siddharth Dushantha пре 5 година
родитељ
комит
f98a5a7991
1 измењених фајлова са 2 додато и 4 уклоњено
  1. 2 4
      tmpmail

+ 2 - 4
tmpmail

@@ -89,9 +89,7 @@ generate_email_address() {
     # So charcters such as dashes, periods, underscore, and numbers are all deleted,
     # giving us a text which only contains lower case letters form A to Z. We then take
     # the first 10 characters, which will be the username of the email address
-    #
-    # shellcheck disable=SC2018
-    USERNAME=$(head /dev/urandom | tr -dc a-z | cut -c1-11)
+    USERNAME=$(head /dev/urandom | tr -dc "[:alnum:]" | cut -c1-11)
 
     # Valid TLDS which 1secmail provides.
     TLDS="com net org"
@@ -107,7 +105,7 @@ generate_email_address() {
 
         # Do a regex check to see if the email address provided by the user is a
         # valid email address
-        REGEXP="[a-z]+@1secmail\.(com|net|org)"
+        REGEXP="[a-z0-9]+@1secmail\.(com|net|org)"
         printf "%b" "$EMAIL_ADDRESS" | grep -E "$REGEXP" >/dev/null
 
         # Get the exit status of the command above