diff options
-rw-r--r-- | MANIFEST | 14 | ||||
-rw-r--r-- | Makefile.PL | 9 | ||||
-rw-r--r-- | lib/AdminPanel/Module/Users.pm | 65 | ||||
-rw-r--r-- | lib/AdminPanel/Shared/Users.pm | 11 | ||||
-rwxr-xr-x | modules/contribfinder.py | 14 | ||||
-rw-r--r-- | share/images/Blank16x16.png | bin | 0 -> 3399 bytes | |||
-rw-r--r-- | share/images/Checked_Shield_Green.png | bin | 0 -> 20753 bytes | |||
-rw-r--r-- | share/images/Checked_Shield_Green16x16.png | bin | 0 -> 3438 bytes | |||
-rw-r--r-- | share/images/Checked_Shield_Green32x32.png | bin | 0 -> 4769 bytes | |||
-rw-r--r-- | share/images/Warning_Shield_Grey.png | bin | 0 -> 18411 bytes | |||
-rw-r--r-- | share/images/Warning_Shield_Grey16x16.png | bin | 0 -> 3374 bytes | |||
-rw-r--r-- | share/images/Warning_Shield_Grey32x32.png | bin | 0 -> 4579 bytes | |||
-rw-r--r-- | share/images/logo_mageia.png (renamed from images/logo_mageia.png) | bin | 2425 -> 2425 bytes | |||
-rw-r--r-- | share/images/mageia.png (renamed from images/mageia.png) | bin | 1788 -> 1788 bytes | |||
-rw-r--r-- | share/images/quit.png (renamed from images/quit.png) | bin | 2880 -> 2880 bytes |
15 files changed, 97 insertions, 16 deletions
@@ -7,9 +7,6 @@ extras/Services/adminService.conf extras/setup.sh extras/Users/adminUser.conf ignore.txt -images/logo_mageia.png -images/mageia.png -images/quit.png lib/AdminPanel/Category.pm lib/AdminPanel/ConfigReader.pm lib/AdminPanel/MainDisplay.pm @@ -42,6 +39,7 @@ lib/AdminPanel/Shared/Services.pm lib/AdminPanel/Shared/Users.pm Makefile.PL MANIFEST This list of files +MODULE_HACKING modules/contribfinder.py modules/rpmdragora/.perl_checker modules/rpmdragora/AUTHORS @@ -106,6 +104,16 @@ scripts/hostmanager scripts/logviewer scripts/mgaAddUser settings.conf +share/images/Blank16x16.png +share/images/Checked_Shield_Green.png +share/images/Checked_Shield_Green16x16.png +share/images/Checked_Shield_Green32x32.png +share/images/logo_mageia.png +share/images/mageia.png +share/images/quit.png +share/images/Warning_Shield_Grey.png +share/images/Warning_Shield_Grey16x16.png +share/images/Warning_Shield_Grey32x32.png t/00-load.t t/01-Locales.t t/02-JournalCtl.t diff --git a/Makefile.PL b/Makefile.PL index f74b4f4..ffbfea8 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,6 +2,10 @@ use 5.006; use strict; use warnings FATAL => 'all'; use ExtUtils::MakeMaker; +use File::ShareDir::Install; + +install_share dist => 'share'; + WriteMakefile( NAME => 'AdminPanel', @@ -28,6 +32,8 @@ WriteMakefile( "Text::Iconv" => 0, "Date::Simple" => 0, "File::HomeDir" => 0, + "File::ShareDir" => 0, + "Data::Password::Meter" => 0, }, EXE_FILES => [ qw( scripts/adminMouse scripts/adminService @@ -40,3 +46,6 @@ WriteMakefile( dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'AdminPanel-*' }, ); + +package MY; +use File::ShareDir::Install 'postamble'; diff --git a/lib/AdminPanel/Module/Users.pm b/lib/AdminPanel/Module/Users.pm index 8be6371..1deacd6 100644 --- a/lib/AdminPanel/Module/Users.pm +++ b/lib/AdminPanel/Module/Users.pm @@ -84,6 +84,8 @@ use security::level; # use run_program; use Config::Auto; +use File::ShareDir ':ALL'; + ## USER is from userdrake use USER; use utf8; @@ -290,7 +292,7 @@ sub ChooseGroup { $rb2->setNotify(1); $rbg->addRadioButton( $rb2 ); - my $hbox = $factory->createHBox($layout); + my $hbox = $factory->createHBox($layout); $align = $factory->createRight($hbox); my $cancelButton = $factory->createPushButton($align, N("Cancel")); my $okButton = $factory->createPushButton($hbox, N("Ok")); @@ -666,6 +668,8 @@ sub _addGroupDialog { such as: full_name, login_name, password, password1, login_shell + full_name, login_name, password, password1, + weakness (icon), login_shell =head3 DESCRIPTION @@ -686,6 +690,7 @@ sub _buildUserData { my $align = $factory->createRight($layout); my $hbox = $factory->createHBox($align); my $label = $factory->createLabel($hbox, N("Full Name:") ); + $factory->createHSpacing($hbox, 2.0); my $fullName = $factory->createInputField($hbox, "", 0); $label->setWeight($yui::YD_HORIZ, 1); $fullName->setWeight($yui::YD_HORIZ, 2); @@ -694,6 +699,7 @@ sub _buildUserData { $align = $factory->createRight($layout); $hbox = $factory->createHBox($align); $label = $factory->createLabel($hbox, N("Login:") ); + $factory->createHSpacing($hbox, 2.0); my $loginName = $factory->createInputField($hbox, "", 0); $label->setWeight($yui::YD_HORIZ, 1); $loginName->setWeight($yui::YD_HORIZ, 2); @@ -703,14 +709,29 @@ sub _buildUserData { $align = $factory->createRight($layout); $hbox = $factory->createHBox($align); $label = $factory->createLabel($hbox, N("Password:") ); + my $weakness = undef; + if (yui::YUI::app()->hasImageSupport()) { + $factory->createHSpacing($hbox, 2.0); + my $file = dist_file('AdminPanel', 'images/Blank16x16.png'); + $weakness = $factory->createImage($hbox, $file); + } + else { + $factory->createHSpacing($hbox, 1.0); + $weakness = $factory->createLabel($hbox, " "); + $factory->createHSpacing($hbox, 1.0); + } my $password = $factory->createInputField($hbox, "", 1); + $weakness->setWeight($yui::YD_HORIZ, 1); $label->setWeight($yui::YD_HORIZ, 1); - $password->setWeight($yui::YD_HORIZ, 2); - + $password->setWeight($yui::YD_HORIZ, 4); + # notify input to check weakness + $password->setNotify(1); + ## user 'confirm Password' $align = $factory->createRight($layout); $hbox = $factory->createHBox($align); $label = $factory->createLabel($hbox, N("Confirm Password:") ); + $factory->createHSpacing($hbox, 2.0); my $password1 = $factory->createInputField($hbox, "", 1); $label->setWeight($yui::YD_HORIZ, 1); $password1->setWeight($yui::YD_HORIZ, 2); @@ -719,6 +740,7 @@ sub _buildUserData { $align = $factory->createRight($layout); $hbox = $factory->createHBox($align); $label = $factory->createLabel($hbox, N("Login Shell:") ); + $factory->createHSpacing($hbox, 2.0); my $loginShell = $factory->createComboBox($hbox, "", 0); my $itemColl = new yui::YItemCollection; foreach my $shell (@shells) { @@ -736,6 +758,7 @@ sub _buildUserData { login_name => $loginName, password => $password, password1 => $password1, + weakness => $weakness, login_shell => $loginShell, ); @@ -794,6 +817,7 @@ sub addUserDialog { $align = $factory->createLeft($layout); $hbox = $factory->createHBox($align); my $label = $factory->createLabel($hbox, N("Home Directory:") ); + $factory->createHSpacing($hbox, 2.0); my $homeDir = $factory->createInputField($hbox, "", 0); $label->setWeight($yui::YD_HORIZ, 1); $homeDir->setWeight($yui::YD_HORIZ, 2); @@ -807,10 +831,11 @@ sub addUserDialog { $align = $factory->createRight($layout); $hbox = $factory->createHBox($align); my $uidManually = $factory->createCheckBox($hbox, N("Specify user ID manually"), 0); + $factory->createHSpacing($hbox, 2.0); my $UID = $factory->createIntField($hbox, N("UID"), 1, 65000, 500); $UID->setEnabled($uidManually->value()); $uidManually->setNotify(1); - $uidManually->setWeight($yui::YD_HORIZ, 2); +# $uidManually->setWeight($yui::YD_HORIZ, 2); $UID->setWeight($yui::YD_HORIZ, 1); ## user 'icon' @@ -855,6 +880,10 @@ sub addUserDialog { my $username = $userData{ login_name }->value(); $homeDir->setValue("/home/$username"); } + elsif ($widget == $userData{password}) { + my $pass = $userData{ password }->value(); + $self->_checkWeaknessPassword($pass, $userData{ weakness }); + } elsif ($widget == $okButton) { ## check data my $username = $userData{ login_name }->value(); @@ -1483,7 +1512,7 @@ sub _storeDataFromUserEditPreviousTab { %userDataWidget: hash containing new YUI widget objects such as: - retunred onject from _buildUserData and + returned onject from _buildUserData and homedir. =head3 DESCRIPTION @@ -1510,6 +1539,7 @@ sub _userDataTabWidget { my $align = $factory->createRight($layout); my $hbox = $factory->createHBox($align); my $label = $factory->createLabel($hbox, N("Home:") ); + $factory->createHSpacing($hbox, 2.0); $userDataWidget{homedir} = $factory->createInputField($hbox, "", 0); $label->setWeight($yui::YD_HORIZ, 1); $userDataWidget{homedir}->setWeight($yui::YD_HORIZ, 2); @@ -1520,7 +1550,9 @@ sub _userDataTabWidget { # login_shell $userDataWidget{full_name}->setValue($userData{full_name}); $userDataWidget{login_name}->setValue($userData{username}); - $userDataWidget{password}->setValue($userData{password}) if $userData{password}; + yui::YUI::ui()->blockEvents(); + $userDataWidget{password}->setValue($userData{password}) if $userData{password}; + yui::YUI::ui()->unblockEvents(); $userDataWidget{password1}->setValue($userData{password1}) if $userData{password1}; $userDataWidget{homedir}->setValue($userData{homedir}); @@ -1980,6 +2012,23 @@ sub _userEdit_Ok { } +# check the password and set the widget accordingly +sub _checkWeaknessPassword { + my ($self, $password, $weakness_widget) = @_; + + my $strongp = AdminPanel::Shared::Users::strongPassword($password); + if (yui::YUI::app()->hasImageSupport()) { + my $file = dist_file('AdminPanel', 'images/Warning_Shield_Grey16x16.png'); + if ($strongp) { + $file = dist_file('AdminPanel', 'images/Checked_Shield_Green16x16.png'); + } + $weakness_widget->setImage($file); + } + else { + # For ncurses set a label + $weakness_widget->setValue(($strongp ? N("Strong") : N("Weak"))); + } +} sub _editUserDialog { my $self = shift; @@ -2084,6 +2133,10 @@ sub _editUserDialog { if ($widget == $cancelButton) { last; } + elsif ($widget == $self->get_edit_tab_widget('password')) { + my $pass = $self->get_edit_tab_widget('password')->value(); + $self->_checkWeaknessPassword($pass, $self->get_edit_tab_widget('weakness')); + } elsif ($widget == $okButton) { ## save changes if ($self->_userEdit_Ok(%userData)) { diff --git a/lib/AdminPanel/Shared/Users.pm b/lib/AdminPanel/Shared/Users.pm index 7745639..411f942 100644 --- a/lib/AdminPanel/Shared/Users.pm +++ b/lib/AdminPanel/Shared/Users.pm @@ -3,6 +3,8 @@ package AdminPanel::Shared::Users; use diagnostics; use strict; +use Data::Password::Meter; + #-###################################################################################### #- misc imports #-###################################################################################### @@ -21,6 +23,7 @@ our @EXPORT = qw( valid_groupname GetFaceIcon Add2UsersGroup + strongPassword ); sub facesdir() { @@ -123,4 +126,12 @@ sub Add2UsersGroup { } +sub strongPassword { + my $passwd = shift; + my $pwdm = Data::Password::Meter->new(); + + # Check a password + return $pwdm->strong($passwd); +} + 1; diff --git a/modules/contribfinder.py b/modules/contribfinder.py index 4adada8..458299a 100755 --- a/modules/contribfinder.py +++ b/modules/contribfinder.py @@ -89,18 +89,18 @@ class mainGui(): self.dialog.destroy() break if event.widget() == self.btnLookAtIt: - if(cmp(self.contributor.strip(),"")!=0): - url = 'http://people.mageia.org/u/%s.html' % self.contributor - os.system("www-browser %s" % url) + if(cmp(self.contributor.strip(),"")!=0): + url = 'http://people.mageia.org/u/%s.html' % self.contributor + os.system("www-browser %s" % url) if event.widget() == self.btnsearch: #self.dialog.startMultipleChanges() #self.rtinformations.setValue("Loading...") #self.dialog.doneMultipleChanges() self.contributor = self.stripErrMessages(self.invokeMgaRepo(self.txtpkgname.value())) - if(cmp(self.contributor.strip(),"")!=0): - outstr = 'Maintainer: <a href="http://people.mageia.org/u/%s.html">%s</a><br />e-mail: <a href="mailto:%s@mageia.org">%s@mageia.org</a>' % (self.contributor,self.contributor,self.contributor,self.contributor) - else: - outstr = '' + if(cmp(self.contributor.strip(),"")!=0): + outstr = 'Maintainer: <a href="http://people.mageia.org/u/%s.html">%s</a><br />e-mail: <a href="mailto:%s@mageia.org">%s@mageia.org</a>' % (self.contributor,self.contributor,self.contributor,self.contributor) + else: + outstr = '' self.rtinformations.setValue(outstr) if __name__ == "__main__": diff --git a/share/images/Blank16x16.png b/share/images/Blank16x16.png Binary files differnew file mode 100644 index 0000000..e885b3c --- /dev/null +++ b/share/images/Blank16x16.png diff --git a/share/images/Checked_Shield_Green.png b/share/images/Checked_Shield_Green.png Binary files differnew file mode 100644 index 0000000..bd2fa28 --- /dev/null +++ b/share/images/Checked_Shield_Green.png diff --git a/share/images/Checked_Shield_Green16x16.png b/share/images/Checked_Shield_Green16x16.png Binary files differnew file mode 100644 index 0000000..9c0db05 --- /dev/null +++ b/share/images/Checked_Shield_Green16x16.png diff --git a/share/images/Checked_Shield_Green32x32.png b/share/images/Checked_Shield_Green32x32.png Binary files differnew file mode 100644 index 0000000..45d8c49 --- /dev/null +++ b/share/images/Checked_Shield_Green32x32.png diff --git a/share/images/Warning_Shield_Grey.png b/share/images/Warning_Shield_Grey.png Binary files differnew file mode 100644 index 0000000..ce32ea7 --- /dev/null +++ b/share/images/Warning_Shield_Grey.png diff --git a/share/images/Warning_Shield_Grey16x16.png b/share/images/Warning_Shield_Grey16x16.png Binary files differnew file mode 100644 index 0000000..2a622e9 --- /dev/null +++ b/share/images/Warning_Shield_Grey16x16.png diff --git a/share/images/Warning_Shield_Grey32x32.png b/share/images/Warning_Shield_Grey32x32.png Binary files differnew file mode 100644 index 0000000..b4ae7a8 --- /dev/null +++ b/share/images/Warning_Shield_Grey32x32.png diff --git a/images/logo_mageia.png b/share/images/logo_mageia.png Binary files differindex 32fe51c..32fe51c 100644 --- a/images/logo_mageia.png +++ b/share/images/logo_mageia.png diff --git a/images/mageia.png b/share/images/mageia.png Binary files differindex 6769fda..6769fda 100644 --- a/images/mageia.png +++ b/share/images/mageia.png diff --git a/images/quit.png b/share/images/quit.png Binary files differindex 322c187..322c187 100644 --- a/images/quit.png +++ b/share/images/quit.png |