API:Validate Login

Home / Support / Documentation
From WHMCS Documentation
Jump to: navigation, search

Contents

Purpose

This command can be used to validate an email address and password against a registered user in WHMCS. If a match is found, it will return successful with the userid and password hash which can then be used to set the $_SESSION['uid'] and $_SESSION['upw'] values respectively in the users session to auto log the user in to WHMCS.

Attributes

  • email - the email address of the user trying to login
  • password2 - the password they supply for authentication

Example Command

External API

 $postfields["action"] = "validatelogin";
 $postfields["email"] = "user@domain.com";
 $postfields["password2"] = "abc123";

Internal API

 $command = "validatelogin";
 $adminuser = "admin";
 $values["email"] = "user@domain.com";
 $values["password2"] = "abc123";
 
 $results = localAPI($command,$values,$adminuser);

Successful Response

 result = success
 userid = matching client ID (if successful)
 contactid = (if a sub-account of a client)
 passwordhash = the password hash needed for the login session

Error Response

result=error&message=Email or Password Invalid # Invalid Email or Password Given.


API Functions
Client Management
Add Client - Update Client - Delete Client - Close Client - Get Clients
Get Clients Details - Get Clients Products - Get Clients Password - Add Contact - Update Contact
Delete Contact - Update Client Product - Upgrade Product - Validate Login - Send Email
Support Tickets
Get Support Departments - Get Support Statuses - Get Tickets - Get Ticket - Get Ticket Predefined Cats
Get Ticket Predefined Replies - Open Ticket - Reply Ticket - Add Ticket Note - Delete Ticket - Update Ticket
Quotes
Create Quote - Update Quote - Delete Quote - Send Quote - Accept Quote
Module Commands
Module Create - Module Suspend - Module Unsuspend - Module Terminate
Domain Commands
Renew Domain - Get Domain Lock - Get Nameservers - Get WHOIS - Request EPP
Update Lock - Update Nameservers - Update WHOIS - Domain WHOIS Lookup
Order Handling
Get Orders - Get Order Statuses - Add Order - Accept Order - Pending Order - Cancel Order - Fraud Order - Delete Order
Payments/Billing
Get Invoice - Get Payment Methods - Create Invoice - Update Invoice - Add Billable Item - Add Invoice Payment
Add Transaction - Add Credit - Capture Payment
Miscellaneous
Get Activity Log - Get Admin Details - Update Admin Notes - Get Currencies - Get Email Templates
Get To-Do Items - Get To-Do Item Statuses - Get Staff Online - Get Stats - Encrypt Password - Decrypt Password