From be4f3bb753db35906af2820b5b58f1aa52e8c1c6 Mon Sep 17 00:00:00 2001 From: Vicent Guardiola Date: Thu, 12 Aug 2004 10:01:19 +0000 Subject: Clean source Add test if conf_file exist --- ldap_wizard/Ldap.pm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ldap_wizard/Ldap.pm b/ldap_wizard/Ldap.pm index c43e2b46..806d9d84 100644 --- a/ldap_wizard/Ldap.pm +++ b/ldap_wizard/Ldap.pm @@ -90,12 +90,23 @@ $o->{pages} = { ! -f $conf_file and $::in->ask_warn(N("Error"), N("You must setup a LDAP server first.")) and return 'set_srv'; return 'add_userposix'; } + + if ($o->{var}{wiz_level} == 1) { + ! -f $conf_file and $::in->ask_yesorno(N("Information "), N("wold you like save an existing OpenLDAP configuration ?")) and return 'sav_old_conf'; + return 'set_srv'; + } }, data => [ { label => N("Your choice:") . "\n\n", val => \$o->{var}{wiz_level}, type => 'list', list => [ keys %level ], format => sub { $level{$_[0]} } }, ], next => 'set_srv', }, + + sav_old_conf => { + name => N("Save an existing configuration"), + next => 'set_srv' + }, + add_userposix => { name => N("LDAP User Add") . "\n\n" . N("User Create in: ") . $o->{var}{defou} . ", " . $o->{var}{suffix}, data => [ @@ -130,7 +141,7 @@ $o->{pages} = { $::in->ask_warn(N("Error"), N("You must enter a password for LDAP.")); return 1; } - if (!($o->{var}{uidpass} eq $o->{var}{uidpass2})) { + if ($o->{var}{uidpass} ne $o->{var}{uidpass2}) { $::in->ask_warn(N("Error"), N("The passwords do not match")); return 1; } @@ -147,7 +158,7 @@ $o->{pages} = { ], complete => sub { - if (!$o->{var}{suffix}) { + if (!$o->{var}{suffix} || $o->{var}{suffix} !~ /dc/ ) { $::in->ask_warn(N("Error"), N("You must enter a suffix for LDAP.")); return 1; } @@ -155,7 +166,7 @@ $o->{pages} = { $::in->ask_warn(N("Error"), N("You must enter a password for LDAP.")); return 1; } - if (!($o->{var}{rootpass} eq $o->{var}{rootpass2})) { + if ($o->{var}{rootpass} ne $o->{var}{rootpass2}) { $::in->ask_warn(N("Error"), N("The passwords do not match")); return 1; } -- cgit v1.2.1