From 8ba1a1156e59eef70ea530272b4446f3ba445d73 Mon Sep 17 00:00:00 2001 From: pad Date: Mon, 6 Sep 1999 10:41:53 +0000 Subject: PAD possible BUG with setRootPassword and addUser --- perl-install/install_steps_interactive.pm | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'perl-install/install_steps_interactive.pm') diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index fd96d1e32..b3008775a 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -393,7 +393,7 @@ wish to access and any applicable user name and password."), #------------------------------------------------------------------------------ sub setRootPassword($) { my ($o) = @_; - $o->{superuser} ||= {}; + $o->{superuser}{password2} ||= $o->{user}{password} ||= ""; my %sup = %{$o->{superuser}}; $o->ask_from_entries_ref(_("Set root password"), @@ -414,29 +414,27 @@ sub setRootPassword($) { #------------------------------------------------------------------------------ sub addUser($) { my ($o) = @_; - $o->{user} ||= {}; $o->{user}{password2} ||= $o->{user}{password} ||= ""; - my $u = $o->{user}; + my %u = %{$o->{user}}; my @fields = qw(realname name password password2); - my @shells = install_any::shells($o); $o->ask_from_entries_ref( _("Add user"), _("Enter a user"), [ _("Real name"), _("User name"), _("Password"), _("Password (again)"), _("Shell") ], - [ (map { \$u->{$_}} @fields), - {val => \$u->{shell}, list => \@shells, not_edit => !$::expert}, + [ (map { \$u{$_}} @fields), + {val => \$u{shell}, list => \@shells, not_edit => !$::expert}, ], focus_out => sub { - print "int $_[0], $u->{name}, $u->{realname},\n"; - ($u->{name}) = $u->{realname} =~ /\U(\S+)/ if $_[0] eq 0; + print "int $_[0], $u{name}, $u{realname}, $u{shell}\n"; + ($u{name}) = $u{realname} =~ /\U(\S+)/ if $_[0] eq 0; }, complete => sub { - $u->{password} eq $u->{password2} or $o->ask_warn('', [ _("You must enter the same password"), _("Please try again") ]), return (1,2); - (length $u->{password} < 6) and $o->ask_warn('', _("This password is too simple")), return (1,1); - $u->{name} or $o->ask_warn('', _("Please give a user name")), return (1,0); - $u->{name} =~ /^[a-z0-9_-]+$/ or $o->ask_warn('', _("The user name must contain only lower cased letters, numbers, `-' and `_'")), return (1,0); + $u{password} eq $u{password2} or $o->ask_warn('', [ _("You must enter the same password"), _("Please try again") ]), return (1,2); + (length $u{password} < 6) and $o->ask_warn('', _("This password is too simple")), return (1,1); + $u{name} or $o->ask_warn('', _("Please give a user name")), return (1,0); + $u{name} =~ /^[a-z0-9_-]+$/ or $o->ask_warn('', _("The user name must contain only lower cased letters, numbers, `-' and `_'")), return (1,0); return 0; }, ); -- cgit v1.2.1