rofi-wifi-menu icon indicating copy to clipboard operation
rofi-wifi-menu copied to clipboard

Empty password string

Open g4rrucho opened this issue 5 years ago • 2 comments

Hello there.

Whenever I press enter when prompted for the wifi password, the WIFIPASS variable preserves the string "if connection is stored, hit enter", since there's no checking if the string is empty or not. This happens in the use case that a connection is saved in the system and when the password isn't typed in a new connection.

Fix incoming senor zbaylin

g4rrucho avatar Aug 12 '20 22:08 g4rrucho

Modify From:

if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
	WIFIPASS=$(echo "if connection is stored, hit enter" | rofi -dmenu -p "password: " -lines 1 -font "$FONT" )
fi
nmcli dev wifi con "$CHSSID" password "$WIFIPASS"

To:

if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
	WIFIPASS=$(echo "if connection is stored, hit enter" | rofi -dmenu -p "password: " -lines 1 -font "$FONT" )
fi
if [[ $WIFIPASS == *"if connection is stored"* ]]; then
    nmcli dev wifi con "$CHSSID"
else
    nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
fi

Sovle the Empty password string

ch4xer avatar May 24 '22 03:05 ch4xer

In my case, removing the whole password handeling solved the issue:

else
	# If the connection is already in use, then this will still be able to get the SSID
	if [ "$CHSSID" = "*" ]; then
		CHSSID=$(echo "$CHENTRY" | sed  's/\s\{2,\}/\|/g' | awk -F "|" '{print $3}')
	fi
		# nmcli con up "$CHSSID"
		nmcli dev wifi con "$CHSSID"
	fi

fi

arnelap avatar Feb 10 '23 11:02 arnelap