nmcli-rofi icon indicating copy to clipboard operation
nmcli-rofi copied to clipboard

Requests passwords even for knowns connections

Open g4rrucho opened this issue 5 years ago • 1 comments

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 avatar Aug 16 '20 15:08 g4rrucho

    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 

g4rrucho avatar Aug 17 '20 17:08 g4rrucho