Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeDNS user ID capital letter dialog #33

Merged
merged 2 commits into from
Dec 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions ConfigureFreedns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ exec 3>&-
user=$(echo "$Values" | sed -n 1p)
pass=$(echo "$Values" | sed -n 2p)

if [[ "$user" =~ [A-Z] ]]
then
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\
Your FreeDNS user ID does not contain uppercase letters. Even though FreeDNS does not inform you, it converts all uppercase letters to lowercase in your user ID.\n\n\
If you log into FreeDNS and go to the main menu, you can see your approved user ID at the top in the right pane.\n\n\
Please try again." 16 50
go_back=1
fi

if [ $go_back -lt 1 ] # if 8
then
if [ "$user" = "" ] || [ "$pass" = "" ] # At least one parameter is blank.
then
go_back=1
Expand All @@ -50,8 +61,7 @@ then
wget -O /tmp/hosts "$arg"
if [ ! "`grep 'Could not authenticate' /tmp/hosts`" = "" ] # Failed to log in
then
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\n\
Failed to authenticate. Try again." 8 50
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\nFailed to authenticate. Try again." 8 50
go_back=1
fi

Expand All @@ -60,17 +70,14 @@ then
Lines=$(awk 'END{print NR}' /tmp/hosts)
if [ $Lines -eq 0 ] # No hostnames # if 5
then
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\
No subdomains found. Ensure you have one in your Free DNS account, and try again." 9 50
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\nNo subdomains found. Ensure you have one in your Free DNS account, and try again." 9 50
go_back=1

elif [ $Lines -gt 1 ] # More than one hostname
then
clear
exec 3>&1
subvalue=$(dialog --colors --ok-label "Submit" --form " \Zr Developed by the xDrip team \Zn\n\n\n\
You have more than one subdomain. Enter the subdomain you want to use. \n\
It should look like mine.strangled.net" 12 50 0 "Subdomain:" 1 1 "$subd" 1 14 25 0 2>&1 1>&3)
subvalue=$(dialog --colors --ok-label "Submit" --form " \Zr Developed by the xDrip team \Zn\n\n\nYou have more than one subdomain. Enter the subdomain you want to use. \nIt should look like mine.strangled.net" 12 50 0 "Subdomain:" 1 1 "$subd" 1 14 25 0 2>&1 1>&3)
response2=$?
if [ $response2 = 255 ] || [ $response2 = 1 ] # canceled or escaped
then
Expand All @@ -85,8 +92,7 @@ then
then
go_back=1
clear
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\n\
You need to enter a subdomain. Try again." 8 50
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\nYou need to enter a subdomain. Try again." 8 50
fi

if [ $go_back -lt 1 ] # if 3
Expand All @@ -95,17 +101,15 @@ then
if [ ! -s /tmp/FullLine ] # Not found
then
go_back=1
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\n\
The subdomain you entered is not one of the ones we found. Try again." 9 50
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\nThe subdomain you entered is not one of the ones we found. Try again." 9 50
fi
if [ $go_back -lt 1 ] # if 2
then
Lines2=$(wc -l < /tmp/FullLine)
if [ $Lines2 -gt 1 ] # More than one found if 1
then
go_back=1
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\n\
The value you entered matches more than one of your subdomains. Try again and enter a unique value." 11 50
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\n\nThe value you entered matches more than one of your subdomains. Try again and enter a unique value." 11 50
else
FLine=$(</tmp/FullLine)
got_them=1 # We have the hostname and direct URL
Expand All @@ -122,6 +126,7 @@ then

fi # fi 6
fi # fi 7
fi # fi 8

done
clear
Expand Down Expand Up @@ -203,4 +208,5 @@ cat > /tmp/FreeDNS_Failed << EOF
Internal error. Must run FreeDNS again.
EOF

dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\nInternal error. Press enter to exit. Then, run FreeDNS Setup again" 9 50
dialog --colors --msgbox " \Zr Developed by the xDrip team \Zn\n\nInternal error. Press enter to exit. Then, run FreeDNS Setup again" 9 50