[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Username already exists
- Subject: Re: [cobalt-users] Username already exists
- From: Jens Kristian Søgaard <jens@xxxxxxxxxxxxxxxxxxxx>
- Date: Sat Mar 31 22:29:07 2001
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
Hi Jeff and all,
> I'm creating a page in PHP (could be perl) where users can signup for an
> user account on our RAQ. I need a script that can check if a username is
> already taken either as a user account or a mail alias. Would somebody
> please share their knowledge or ideas on this topic.
You need to use a combination of a few Cobalt functions. The easiest thing
is to use Perl, and use code like this (just an example -- the code has not
been tested):
use Cobalt::User;
use Cobalt::List;
sub userAlive
{
$username = shift;
return "User already exists in passwd file" if(
Cobalt::User::user_exist( $username ) );
return "Alias already exist with that name" if(
Cobalt::List::alias_exist( $username ) );
return "List already exist with that name" if( Cobalt::List::list_exist(
$username ) );
return "All clear";
}
Remember to check for things like people wanting to add users named "admin",
"wheel" and similar fun stuff.
--
Jens Kristian Søgaard, Mermaid Consulting I/S,
jens@xxxxxxxxxxxxxxxxxxxx,
http://www.mermaidconsulting.com/