cleanup create_user login return
[cloudstore.git] / lib / CloudStore / API.pm
index f68fa88..197e488 100644 (file)
@@ -73,7 +73,7 @@ sub create_user {
        while(<$fh>) {
                my ( $login, $passwd, $uid, $gid, $email, $dir, $shell ) = split(/:/,$_);
                $max_uid = $uid if $uid > $max_uid;
-               $found = $uid if $email eq $new_email;
+               $found = $login if $email eq $new_email;
        }
        close($fh);
 
@@ -91,7 +91,7 @@ sub create_user {
                open(my $fh, '>>', $self->{passwd});
                print $fh "u$max_uid:$new_passwd:$max_uid:$port:$new_email:$dir:/bin/true\n";
                close($fh);
-               $found = $max_uid;
+               $found = "u$max_uid";
 
                mkdir $dir;
                chown $max_uid, $port, $dir;
@@ -106,7 +106,7 @@ sub create_user {
        # FIXME update quota only on create?
        $self->gearman_do( $self->dir2gearman( $dir, 'quota', 'set' ) => "$found $new_quota" );
 
-       return 'u' . $found;
+       return $found;
 }
 
 sub mkbasepath {