diff options
author | Aurélien Lefebvre <alefebvre@mandriva.com> | 2009-08-17 12:44:21 +0000 |
---|---|---|
committer | Aurélien Lefebvre <alefebvre@mandriva.com> | 2009-08-17 12:44:21 +0000 |
commit | 37840927cc9d8066c59cce7de5c3880c5d335310 (patch) | |
tree | 19228fc3f18abec278d85a5fbe067da6f3ada1f3 /perl-install/interactive/gtk.pm | |
parent | 112ac7048e587548f1279b2823e5f8960a30f129 (diff) | |
download | drakx-37840927cc9d8066c59cce7de5c3880c5d335310.tar drakx-37840927cc9d8066c59cce7de5c3880c5d335310.tar.gz drakx-37840927cc9d8066c59cce7de5c3880c5d335310.tar.bz2 drakx-37840927cc9d8066c59cce7de5c3880c5d335310.tar.xz drakx-37840927cc9d8066c59cce7de5c3880c5d335310.zip |
- added password weakness display feature in interactive
- adduserdrake
o now use password weakness display
Diffstat (limited to 'perl-install/interactive/gtk.pm')
-rw-r--r-- | perl-install/interactive/gtk.pm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 4a93934e1..e6ad4aaff 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -545,7 +545,14 @@ sub create_widget { }; } else { $w = Gtk2::Entry->new; - $w->signal_connect(changed => $onchange->(sub { $w->get_text })); + $w->signal_connect(changed => $onchange->(sub { + if ($e->{weakness_check}) { + require authentication; + my $password_weakness = authentication::compute_password_weakness($w->get_text); + $w->modify_base('GTK_STATE_NORMAL', get_weakness_color($password_weakness)); + } + $w->get_text; + })); $w->signal_connect(focus_in_event => sub { $w->select_region(0, -1) }); $w->signal_connect(focus_out_event => sub { $w->select_region(0, 0) }); $set = sub { $w->set_text($_[0]) if $_[0] ne $w->get_text }; @@ -958,4 +965,16 @@ sub kill { @tempory::objects = (); } +sub get_weakness_color { + my ($password_weakness) = @_; + my %weakness_color = ( + 1 => '#fd3434', + 2 => '#fd6c34', + 3 => '#f7871a', + 4 => '#2ae000', + 5 => '#30ff00'); + my $weakness_color = $weakness_color{$password_weakness} || '#ffffff'; + Gtk2::Gdk::Color->parse($weakness_color); +} + 1; |