Dear Guys,

I am stuck at something really fundamental. I am coding a wee cgi page to
change a OpenLDAP password, for Windows users on a Samba Server/LDAP
backend.

I haven't added any Net::LDAP stuff yet, just testing the basic password
form.

Would someone be so kind as to offer a simple reason my test doesn't work?

Should the le '6', I think so, but it never catches it?

Thanks:

#!/usr/bin/perl -T

use warnings;
use strict;
use CGI::Carp qw(fatalsToBrowser);

use CGI qw/:standard/;
print header,
  start_html('Change your Windows Password'),
  h1('Change your Windows® Password:'),
  start_form,
  "Username:",
  textfield('name'),
  br,
  "Old Password:",
  password_field(
    -name      => 'oldpasswd',
    -size      => 10,
    -maxlength => 10
  ),
  br,
  "New Password:",
  password_field(
    -name      => 'newpasswd',
    -size      => 10,
    -maxlength => 10
  ),
  br,
  "Verify Password:",
  password_field(
    -name      => 'verify_passwd',
    -size      => 10,
    -maxlength => 10
  ),
  br,
  submit,
  end_form,
  hr;

if ( param() ) {
    my $name = param('name');
    my $oldpasswd = param('oldpasswd');
    my $newpasswd = param('newpasswd');
    my $verify_passwd = param('verify_passwd');

    if ( $name eq '') {
      print "Must have a username!!\n";
      hr;
    } elsif ($oldpasswd eq '') {
      print "Please enter your existing password!\n";
      hr;
    } elsif ($newpasswd eq '') {
      print "Must have a new password!\n";
      hr;
    } elsif ($newpasswd le 6) {
      print "Your password must be more than or equal to 6 characters\n";
      hr;
    } elsif ($newpasswd ne $verify_passwd) {
      print "Sorry, your new passwords do not match!\n";
      hr;
    } elsif ($oldpasswd eq $newpasswd) {
      print "Sorry, you are trying to use your existing password!\n";
      hr;
    } elsif ( ($newpasswd eq $verify_passwd) && ($oldpasswd ne $newpasswd)
) {
      print "Your new password is ", em( escapeHTML($verify_passwd) ),
      hr;
    } else {
      print "Situation unexpected, please contact Suretec!\n";
    }
}



-- 
Walking the road to enlightenment... I found a penguin and a camel on the
way..... Fancy a [EMAIL PROTECTED] Just ask!!!
http://aberdeen.pm.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to