sineto / nmcli-rofi

A simple manager for network connections using rofi and nmcli
MIT License
62 stars 16 forks source link

Requests passwords even for knowns connections #13

Open g4rrucho opened 4 years ago

g4rrucho commented 4 years ago

For every known connections, the script still asks for the password.

I believe that this can be achieved with command "nmcli connection show" Just an idea here.

g4rrucho commented 4 years ago
    else
        if [[ "$OPS" =~ "WPA2" ]] || [[ "$OPS" =~ "WEP" ]]; then
          WIFIPASS=$(echo -en "" | rofi -dmenu -password -p "PASSWORD" \
            -mesg "Enter the PASSWORD of the network" -lines 0 -font "$FONT")
        fi

        if [ -z "$WIFIPASS" ]; then
          nmcli dev wifi con "$CHSSID"
        fi

        if [[ "$CHSSID" != '' ]] && [[ "$WIFIPASS" != '' ]]; then
          nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
        fi
    fi

This else is the last from the main function btw. Since the user knows which connection it's already saved, the password won't be entered.

Another way to do this could be with the 'nmcli connection show' command, if the user doesn't want to remember which connections he has saved, which makes more sense in my mind.

if [ -n $( nmcli connection show | grep "$CHSSID" ) ]; then
   nmcli dev wifi con "$CHSSID"
fi