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

DietPi-Config | WiFi Hotspot: Do not allow to enter a <8 character key #6574

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
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
14 changes: 11 additions & 3 deletions dietpi/dietpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,8 @@ _EOF_
until [[ $G_WHIP_RETURNED_VALUE == [[:upper:]][[:upper:]] ]]
do
G_WHIP_INPUTBOX "${error}Please enter a 2 capital letter country code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" || return 0
error="[FAILED] Invalid country code ($G_WHIP_RETURNED_VALUE)"
error="[FAILED] Invalid country code ($G_WHIP_RETURNED_VALUE)\n\n"
G_WHIP_DEFAULT_ITEM=$G_WHIP_RETURNED_VALUE
done
fi
WIFI_COUNTRYCODE=$G_WHIP_RETURNED_VALUE
Expand Down Expand Up @@ -2704,8 +2705,15 @@ This is mainly aimed at PINE A64 which may have a hardware issue that causes uns

'Key')

local error
G_WHIP_DEFAULT_ITEM=$HOTSPOT_KEY
G_WHIP_INPUTBOX 'Please enter a key/password with a minimum of 8 characters for your WiFi hotspot:' && HOTSPOT_KEY=$G_WHIP_RETURNED_VALUE
until (( ${#G_WHIP_RETURNED_VALUE} > 7 ))
do
G_WHIP_INPUTBOX "${error}Please enter a key/password with a minimum of 8 characters for your WiFi hotspot:" || return 0
error='[FAILED] The entered key is too short.\n\n'
G_WHIP_DEFAULT_ITEM=$G_WHIP_RETURNED_VALUE
done
HOTSPOT_KEY=$G_WHIP_RETURNED_VALUE
;;

'SSID')
Expand Down Expand Up @@ -2762,7 +2770,7 @@ This is mainly aimed at PINE A64 which may have a hardware issue that causes uns

'Disable')

G_WHIP_YESNO 'Would you like to disable the WiFi adapter?\n - (NOTICE) All WiFi connections will be dropped.' || return
G_WHIP_YESNO 'Would you like to disable the WiFi adapter?\n - (NOTICE) All WiFi connections will be dropped.' || return 0
WIFI_DISABLED=1
G_EXEC systemctl disable --now dietpi-wifi-monitor
Network_ApplyChanges
Expand Down
3 changes: 2 additions & 1 deletion dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -7949,6 +7949,7 @@ _EOF_
[[ $wifi4 == [01] ]] || wifi4=0
[[ $wifi5 == [01] ]] || wifi5=0
[[ $freq5 == [01] ]] || freq5=0
(( ${#key} > 8 )) || { G_DIETPI-NOTIFY 1 'WiFi key from dietpi.txt is too short (less than 8 characters), falling back to default: "dietpihotspot"'; key='dietpihotspot'; }
# - WiFi 5 implies 5 GHz and 5 GHz requires at least WiFi 4
(( $wifi5 )) && freq5=1
(( $freq5 && ! $wifi5 )) && wifi4=1
Expand Down Expand Up @@ -7982,7 +7983,7 @@ macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=${key:-dietpihotspot}
wpa_passphrase=$key
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Expand Down