1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 20:38:00 +01:00

Merged reyammer's branch lp:~reyammer/wicd/bug-476982: implement password hiding (LP: #476982)

This commit is contained in:
David Paleino
2011-09-15 12:50:21 +02:00
parent a526c2108d
commit bdb64eab1c
17 changed files with 72 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ author = Adam Blackburn
version = 2
require username *Username password *Password
optional pac_file *Path_To_PAC_File
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -3,7 +3,7 @@ author = Dan O'Reilly
version = 1
require identity *Identity private_key *Private_Key private_key_passwd *Private_Key_Password
optional ca_cert *Path_to_CA_Cert client_cert *Path_to_Client_Cert
protected identity *Identity private_key *Private_Key private_key_passwd *Private_Key_Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = LEAP with WEP
author = Adam Blackburn
version = 1
require username *Username password *Password
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = PEAP with GTC
author = Adam Blackburn
version = 2
require identity *Identity password *Password
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -3,6 +3,7 @@ author = Fralaltro
version = 1
require identity *Identity password *Password
optional ca_cert *Path_to_CA_Cert
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = TTLS with WEP
author = Adam Blackburn
version = 1
require identity *Identity password *Password auth *Authentication
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = WEP (Hex [0-9/A-F])
author = Adam Blackburn
version = 1
require key *Key
protected key *Key
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = WEP (Passphrase)
author = Adam Blackburn
version = 1
require passphrase *Passphrase
protected passphrase *Passphrase
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = WEP Shared/Restricted
author = Dan O'Reilly
version = 1
require key *Key
protected key *Key
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = WPA 1/2 (Passphrase)
author = Adam Blackburn
version = 1
require key *Key
protected key *Key
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = WPA-PEAP
author = atiketemola
version = 1
require identity *Username domain *Domain password *Password
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = WPA 1/2 (Preshared Key)
author = Adam Blackburn
version = 1
require apsk *Preshared_Key
protected apsk *Preshared_Key
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = WPA2-LEAP
author = atiketemola
version = 1
require username *Username password *Password
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -2,6 +2,7 @@ name = WPA2-PEAP
author = atiketemola
version = 1
require identity *Username domain *Domain password *Password
protected password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={

View File

@@ -176,3 +176,43 @@ class GreyLabel(gtk.Label):
def set_label(self, text):
self.set_markup(text)
self.set_alignment(0, 0)
class ProtectedLabelEntry(gtk.HBox):
""" A LabelEntry with a CheckButton that protects the entry text. """
def __init__(self, label_text):
gtk.HBox.__init__(self)
self.entry = gtk.Entry()
self.entry.set_size_request(200, -1)
self.entry.set_visibility(False)
self.label = LeftAlignedLabel()
self.label.set_text(label_text)
self.label.set_size_request(165, -1)
self.check = gtk.CheckButton()
self.check.set_size_request(5, -1)
self.check.set_active(False)
self.check.set_focus_on_click(False)
self.pack_start(self.label, fill=True, expand=True)
self.pack_start(self.check, fill=True, expand=True)
self.pack_start(self.entry, fill=False, expand=False)
self.label.show()
self.check.show()
self.entry.show()
self.check.connect('clicked', self.click_handler)
self.show()
def set_entry_text(self, text):
# For compatibility...
self.entry.set_text(text)
def get_entry_text(self):
return self.entry.get_text()
def set_sensitive(self, value):
self.entry.set_sensitive(value)
self.label.set_sensitive(value)
self.check.set_sensitive(value)
def click_handler(self, widget=None, event=None):
active = self.check.get_active()
self.entry.set_visibility(active)

View File

@@ -30,7 +30,7 @@ import wicd.misc as misc
import wicd.wpath as wpath
import wicd.dbusmanager as dbusmanager
from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool
from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input
from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input, ProtectedLabelEntry
from wicd.translations import language
@@ -358,7 +358,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
self.chkbox_encryption.set_active(False)
self.combo_encryption.set_sensitive(False)
self.encrypt_types = misc.LoadEncryptionMethods()
information_button = gtk.Button(stock=gtk.STOCK_INFO)
self.button_hbox.pack_start(information_button, False, False)
information_button.connect('clicked', lambda *a, **k: WirelessInformationDialog(networkID, self))
@@ -532,10 +532,15 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
fields = methods[ID][type_]
for field in fields:
if language.has_key(field[1]):
box = LabelEntry(language[field[1].lower().replace(' ','_')])
field_text = language[field[1].lower().replace(' ','_')]
else:
box = LabelEntry(field[1].replace('_',' '))
box.set_auto_hidden(True)
field_text = field[1].replace('_',' ')
if field in methods[ID]['protected']:
box = ProtectedLabelEntry(field_text)
else:
box = LabelEntry(field_text)
self.vbox_encrypt_info.pack_start(box)
# Add the data to a dict, so that the information
# can be easily accessed by giving the name of the wanted

View File

@@ -335,6 +335,7 @@ def _parse_enc_template(enctype):
cur_type["fields"] = []
cur_type['optional'] = []
cur_type['required'] = []
cur_type['protected'] = []
cur_type['name'] = ""
for index, line in enumerate(f):
if line.startswith("name") and not cur_type["name"]:
@@ -353,6 +354,13 @@ def _parse_enc_template(enctype):
# An error occured parsing the optional line.
print "Invalid 'optional' line found in template %s" % enctype
continue
elif line.startswith("protected"):
cur_type["protected"] = __parse_field_ent(parse_ent(line, "protected"),
field_type="protected")
if not cur_type["protected"]:
# An error occured parsing the protected line.
print "Invalid 'protected' line found in template %s" % enctype
continue
elif line.startswith("----"):
# We're done.
break