Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

ValidateLogin()

hitmanpt edited this page Feb 9, 2017 · 4 revisions

Through this explanation we assume that you have using WHMCS_API; on the begining of the file
And the API() class initialized as _api
If needed check the Getting Started page

Contents


Function Overview

Prototype: public ValidateLogin.ValidateLogin ValidateLogin(string Email, string Password)

Input:

  • Email: The email of the user to validate (required)
  • Password: The password of the user to validate in plaintext (required)

Output: ValidateLogin Model

Exception: "An API Error has Ocurred" witch contains an inner exception with further explanation of the error


Function Details

To call it just use ValidateLogin.ValidateLogin login = _api.ValidateLogin("useremail@example.com", "plaintextpassword");

The GetClientDetails model is inside it's own namespace (more info)

You can store the UserID and PasswordHash in the Session Session["uid"] and Session["upw"]

View all details about ValidateLogin Model

WHMCS API Reference: https://developers.whmcs.com/api-reference/validatelogin/

Donate


Full example

using WHMCS_API;

namespace YourApp
{
  class YourClass
  {
    public void YourFunction()
    {
       API _api = new API("username", "password", "accesskey", "url");
       ValidateLogin.ValidateLogin login = _api.ValidateLogin("useremail@example.com", "plaintextpassword");
       //Let's keep the user logged in
       Session["uid"] = login.UserID;
       Session["upw"] = login.PasswordHash;
       Console.WriteLine("UserID: {0}", login.UserID);
    }
  }
}