summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-03-24 21:00:37 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-03-24 21:00:37 +0000
commit41ec020c63526822535fe3cd0a5c47f4f9394383 (patch)
tree86a276e1c8fb3939563a3add8e6d691982f72230
parent2243ce9553f4ebfe3f48859b54fb742a380a505d (diff)
downloaddrakx-backup-do-not-use-41ec020c63526822535fe3cd0a5c47f4f9394383.tar
drakx-backup-do-not-use-41ec020c63526822535fe3cd0a5c47f4f9394383.tar.gz
drakx-backup-do-not-use-41ec020c63526822535fe3cd0a5c47f4f9394383.tar.bz2
drakx-backup-do-not-use-41ec020c63526822535fe3cd0a5c47f4f9394383.tar.xz
drakx-backup-do-not-use-41ec020c63526822535fe3cd0a5c47f4f9394383.zip
(ask_users): when "Done" is pressed, do "Accept User" if a user is given.
-rw-r--r--perl-install/any.pm22
1 files changed, 12 insertions, 10 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index d6f801398..91110e9f8 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -711,6 +711,14 @@ sub ask_users {
$u->{shell} ||= '/bin/bash';
my $names = @$users ? _("(already added %s)", join(", ", map { $_->{realname} || $_->{name} } @$users)) : '';
+ my $verif = sub {
+ $u->{password} eq $u->{password2} or $in->ask_warn('', [ _("The passwords do not match"), _("Please try again") ]), return (1,2);
+ $security > 3 && length($u->{password}) < 6 and $in->ask_warn('', _("This password is too simple")), return (1,2);
+ $u->{name} or $in->ask_warn('', _("Please give a user name")), return (1,0);
+ $u->{name} =~ /^[a-z0-9_-]+$/ or $in->ask_warn('', _("The user name must contain only lower cased letters, numbers, `-' and `_'")), return (1,0);
+ member($u->{name}, map { $_->{name} } @$users) and $in->ask_warn('', _("This user name is already added")), return (1,0);
+ return 0;
+ };
$in->ask_from_entries_refH_powered(
{ title => _("Add user"),
messages => _("Enter a user\n%s", $names),
@@ -722,14 +730,8 @@ sub ask_users {
$u->{name} ||= lc first($u->{realname} =~ /((\w|-)+)/);
}
},
- complete => sub {
- $u->{password} eq $u->{password2} or $in->ask_warn('', [ _("The passwords do not match"), _("Please try again") ]), return (1,2);
- $security > 3 && length($u->{password}) < 6 and $in->ask_warn('', _("This password is too simple")), return (1,2);
- $u->{name} or $in->ask_warn('', _("Please give a user name")), return (1,0);
- $u->{name} =~ /^[a-z0-9_-]+$/ or $in->ask_warn('', _("The user name must contain only lower cased letters, numbers, `-' and `_'")), return (1,0);
- member($u->{name}, map { $_->{name} } @$users) and $in->ask_warn('', _("This user name is already added")), return (1,0);
- return 0;
- },
+ complete => $verif,
+ canceled => sub { $u->{name} ? &$verif : 0; },
} }, [
{ label => _("Real name"), val => \$u->{realname} },
{ label => _("User name"), val => \$u->{name} },
@@ -740,9 +742,9 @@ sub ask_users {
{ label => _("Icon"), val => \$u->{icon}, list => [ facesnames($prefix) ], icon2f => sub { face2png($_[0], $prefix) }, format => \&translate },
),
],
- ) or return;
+ );
- push @$users, $u;
+ push @$users, $u if $u->{name};
$u = {};
}
}