]> git.proxmox.com Git - pve-access-control.git/commitdiff
set minimal and maximal password length
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 13 Jan 2012 11:04:36 +0000 (12:04 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 13 Jan 2012 11:18:40 +0000 (12:18 +0100)
PVE/API2/User.pm

index a9198699f97bcd1038c3d4dbaa833d3217c8e661..459356704fcc7b499fbb1e230a093de5ef56b17a 100644 (file)
@@ -90,7 +90,7 @@ __PACKAGE__->register_method ({
        additionalProperties => 0,
        properties => {
            userid => get_standard_option('userid'),
-           password => { type => 'string', optional => 1 },
+           password => { type => 'string', optional => 1, minLength => 5, maxLength => 64 },
            groups => { type => 'string', optional => 1, format => 'pve-groupid-list'},
            firstname => { type => 'string', optional => 1 },
            lastname => { type => 'string', optional => 1 },
@@ -125,7 +125,7 @@ __PACKAGE__->register_method ({
                    if $usercfg->{users}->{$username};
                         
                PVE::AccessControl::domain_set_password($realm, $ruid, $param->{password})
-                   if $param->{password};
+                   if defined($param->{password});
 
                my $enable = defined($param->{enable}) ? $param->{enable} : 1;
                $usercfg->{users}->{$username} = { enable => $enable };
@@ -200,7 +200,7 @@ __PACKAGE__->register_method ({
        additionalProperties => 0,
        properties => {
            userid => get_standard_option('userid'),
-           password => { type => 'string', optional => 1 },
+           password => { type => 'string', optional => 1, minLength => 5, maxLength => 64 },
            groups => { type => 'string', optional => 1,  format => 'pve-groupid-list'  },
            append => { 
                type => 'boolean', 
@@ -240,7 +240,7 @@ __PACKAGE__->register_method ({
                    if !$usercfg->{users}->{$username};
 
                PVE::AccessControl::domain_set_password($realm, $ruid, $param->{password})
-                   if $param->{password};
+                   if defined($param->{password});
 
                $usercfg->{users}->{$username}->{enable} = $param->{enable} if defined($param->{enable});