summaryrefslogtreecommitdiffstats
path: root/perl-install/install_steps_interactive.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-09-05 23:02:56 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-09-05 23:02:56 +0000
commit0c77eeabed86bbe54662d435016d7290ffd74141 (patch)
treeba6bcfd2bdcb33e87e62c4a4f32a397211eda92c /perl-install/install_steps_interactive.pm
parent5798823e331c86fb3f97593b0cd2820224767d15 (diff)
downloaddrakx-0c77eeabed86bbe54662d435016d7290ffd74141.tar
drakx-0c77eeabed86bbe54662d435016d7290ffd74141.tar.gz
drakx-0c77eeabed86bbe54662d435016d7290ffd74141.tar.bz2
drakx-0c77eeabed86bbe54662d435016d7290ffd74141.tar.xz
drakx-0c77eeabed86bbe54662d435016d7290ffd74141.zip
no_comment
Diffstat (limited to 'perl-install/install_steps_interactive.pm')
-rw-r--r--perl-install/install_steps_interactive.pm35
1 files changed, 19 insertions, 16 deletions
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index a4571ec7b..dee757d8b 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -417,26 +417,29 @@ sub addUser($) {
my ($o) = @_;
$o->{user} ||= {};
$o->{user}{password2} ||= $o->{user}{password};
- my $sup = $o->{user};
+ my $u = $o->{user};
my @fields = qw(name password password2 realname);
my @shells = install_any::shells($o);
- $o->ask_from_entries_ref(_("Add user"),
- _("Enter a user"),
- [_("User name"), _("Password"), _("Password (again)"), _("Real name"), _("Shell"),],
- [(map { \$sup->{$_}} @fields),
- {val => \$sup->{shell}, list => \@shells, not_edit => !$::expert},
- ],
- complete => sub {
- $sup->{password} eq $sup->{password2} or $o->ask_warn('', [ _("You must enter the same password"), _("Please try again") ]), return (1,2);
- (length $sup->{password} < 6) and $o->ask_warn('', _("This password is too simple")), return (1,1);
- $sup->{name} or $o->ask_warn('', _("Please give a user name")), return (1,0);
- $sup->{name} =~ /^[a-z0-9_-]+$/ or $o->ask_warn('', _("The user name must contain only lower cased letters, numbers, `-' and `_'")), return (1,0);
- return 0;
- }
-
- );
+ $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},
+ ],
+ focus_out => sub {
+ ($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);
+ return 0;
+ },
+ );
install_steps::addUser($o);
$o->{user} = {};
goto &addUser if $::expert;