Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Member
    Join Date
    Oct 2007
    Location
    Franconville, Val-d'Oise, France
    Posts
    19

    Exclamation How to verify if login can be used ?

    Hello,

    I'm currently programming a reseller automated system based on cPanel.
    I actually have a little problem : during the registering, the user must choose a login.

    I want to verify if the login already exists or not and I don't seems to be able to do that.

    The only thing to know this if to try to create a new account, and at this moment, if the request return me a "Sorry, that username is already taken. Check /usr/passwd", it's that this login already exists.

    Is there any solution to test the login before creating a new account, or simply list all usernames that are on cPanel ?

    Thanks for your help,

    Vincent 'hokys' Composieux
    Last edited by zone-vip; 08-27-2008 at 11:17 AM.

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by zone-vip View Post
    Hello,

    I'm currently programming a reseller automated system based on cPanel.
    I actually have a little problem : during the registering, the user must choose a login.

    I want to verify if the login already exists or not and I don't seems to be able to do that.

    The only thing to know this if to try to create a new account, and at this moment, if the request return me a "Sorry, that username is already taken. Check /usr/passwd", it's that this login already exists.

    Is there any solution to test the login before creating a new account, or simply list all usernames that are on cPanel ?

    Thanks for your help,

    Vincent 'hokys' Composieux
    You can search for an existing user account using our XML API as documented here:

    http://www.cpanel.net/plugins/xmlapi/listaccts.html

  3. #3
    Member
    Join Date
    Oct 2007
    Location
    Franconville, Val-d'Oise, France
    Posts
    19

    Default

    Thanks for your reply.

    When i call this url to test your XML API :
    http://mydomain.com:2086/xml-api/lis...rch=*=vincenth

    the XML returns me :

    Code:
    Erreur d'analyse XML : aucun élément trouvé
    Emplacement : http://mydomain.com:2086/xml-api/listaccts?searchtype=user&search=vincenth
    Numéro de ligne 3, Colonne 1 :
    ^
    When i try to create an account with this username using the PHP Accounting API, it returns me :

    Code:
    0 Sorry that username (vincenth) is taken. Check /etc/passwd
    (it's normal, i created him before, but the API don't list me the user list, using listaccts() like it's specified here : http://www.cpanel.net/remoteaccess-php.html).

    Any other solution ?

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by zone-vip View Post
    Thanks for your reply.

    When i call this url to test your XML API :
    http://mydomain.com:2086/xml-api/lis...rch=*=vincenth

    the XML returns me :

    Code:
    Erreur d'analyse XML : aucun élément trouvé
    Emplacement : http://mydomain.com:2086/xml-api/listaccts?searchtype=user&search=vincenth
    Numéro de ligne 3, Colonne 1 :
    ^
    The XML-API should not be returning that. If a user is not found, it will return:

    Code:
    <listaccts>
    <status>1</status>
    <statusmsg>Ok</statusmsg>
    </listaccts>
    −
    <!--
     Web Host Manager  (c) cPanel, Inc. 2008 http://cpanel.net/  Unauthorized copying is prohibited. 
    -->
    What is the full version number for your installation of cPanel/WHM?

  5. #5
    Member
    Join Date
    Oct 2007
    Location
    Franconville, Val-d'Oise, France
    Posts
    19

    Default

    I'm using cPanel 11.23.6-RELEASE build 26881.

  6. #6
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by zone-vip View Post
    I'm using cPanel 11.23.6-RELEASE build 26881.
    Hmm, several XML-API issues were resolved in 11.23.6. Were you calling this URL by entering it into your address bar in your web browser? If so, were you logged into WHM at the time as a root-level user or reseller?

  7. #7
    Member
    Join Date
    Oct 2007
    Location
    Franconville, Val-d'Oise, France
    Posts
    19

    Default

    Yes i'm calling the URL in a web browser.
    When i call it, i'm logged with a reseller account. Is there a problem ?

    Thanks and sorry for the time you spend ...

  8. #8
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by zone-vip View Post
    Yes i'm calling the URL in a web browser.
    When i call it, i'm logged with a reseller account. Is there a problem ?

    Thanks and sorry for the time you spend ...
    There shouldn't be an issue. However, as a reseller, you would only have access to knowing the usernames of users you own. Ideally, it would be the root user handling this via the APIs.

    As a reseller, the only alternative I am aware of is similar to what you are doing right now. Though in the long-term you may wish to consider moving to the XML-API as it offers more functionality than the older accounting system.

  9. #9
    Member
    Join Date
    Oct 2007
    Location
    Franconville, Val-d'Oise, France
    Posts
    19

    Default

    Ok, i will try this manipulation on the root-level account.

    However, i will certainly move to use the XML-API.

    Thanks for all,

    Vincent 'hokys' Composieux

  10. #10
    Member
    Join Date
    Oct 2007
    Location
    Franconville, Val-d'Oise, France
    Posts
    19

    Default

    Just for information : it works perfectly with a root-level account. Thanks ;-)

    I asked to my admin to turn the "list accounts" to enable and it works with my reseller account to.

  11. #11
    Member
    Join Date
    Oct 2007
    Location
    Franconville, Val-d'Oise, France
    Posts
    19

    Default

    Hum, another little question : Is it possible to create a root-level account with the only privilege to list the cPanel users, or simply remove some rights to give him the minimum ? (just for security)

  12. #12
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by zone-vip View Post
    Hum, another little question : Is it possible to create a root-level account with the only privilege to list the cPanel users, or simply remove some rights to give him the minimum ? (just for security)
    At this time, this functionality is not present in cPanel/WHM. Feel welcome to request it at http://bugzilla.cPanel.net

Similar Threads & Tags
Similar threads

  1. How to verify...
    By foxdevil in forum New User Questions
    Replies: 2
    Last Post: 05-16-2008, 06:04 AM
  2. 'Use callouts to verify' vs 'Verify the existence of email senders.'
    By Bradl3y in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-26-2007, 09:57 AM
  3. Replies: 6
    Last Post: 10-30-2005, 07:32 AM
  4. Verify Sender?
    By teck in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-02-2002, 11:34 AM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube