From fdb30a4cc5609607e2ba632384b14ba080d37788 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 13 Jan 2012 12:04:36 +0100 Subject: [PATCH] set minimal and maximal password length --- PVE/API2/User.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PVE/API2/User.pm b/PVE/API2/User.pm index a919869..4593567 100644 --- a/PVE/API2/User.pm +++ b/PVE/API2/User.pm @@ -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}); -- 2.39.2