You can choose to let your users register only with a sponsor validating the process.
There are a few ways you can choose to register a user with a sponsored validation.
For this example, we will have the user requesting credentials to a sponsor that will receive a mail for validation containing a URL. After the sponsor opens the URL, the guest will receive a mail with his or her credentials.
Here is how it looks like from the user perspective:

Here the user enters his name, his email, and the sponsor email. When clicking the button, a mail will be sent to the sponsor.

After the sponsor validates the guest by clicking the URL in the mail, the guest receives his credentials and can put them in sign in section to log into the Wi-Fi.

When uploading the portal, it will be parsed to look for an HTML element with the source property set to the registering method. It must be in a form HTML element. The form element itself can have no properties, they will be added automatically when uploading the template. It is advised to do it in a hidden input element like this:

<input type="hidden" name="source" value="sponsor">

Integrate the sponsored registration in your portal template

To let your users register with a sponsor, you'll have to get context from where your user connects. For this, we provide you with a simple way to do it. Just include this shortcode in your template:

{CONFIG_JSON}

This will be parsed and modified to a JSON string when uploading your portal.
Inside will be the company hash of the location hosting your portal.
With this information, you can make an HTTP request to our API to register your user. Here's an example with Javascript:

var user = {
  mail:'john.doe@mail.com',
  firstname:'John',
  lastname:'Doe',
  sponsor:'sponsor@mail.com'
};

var registration = 'sponsor';

var configJSON = {CONFIG_JSON};

var url = 'https://login.cloudi-fi.net/api/2/register/'+ registration +'?ch='+ configJSON["c_hash"] +'&firstname='+ user.firstname +'&lastname='+ user.lastname +'&guest='+ user.mail +'&input='+ user.sponsor;

$.get(url,function(data){
  console.log(data);
});

Let's dive into this step by step:

var user = {
  mail:'john.doe@mail.com',
  firstname:'John',
  lastname:'Doe',
  sponsor:'sponsor@mail.com'
};

First, we store our user information in a variable. For the sake of the example, we didn't include any HTML reference. It is usually retrieved from the form on your portal.

var registration = 'sponsor';

We declare a variable with the registration method you want for your portal, in this case, 'sponsor' means the user will need a sponsor validation to access the Wi-Fi.

var configJSON = {CONFIG_JSON};

This line will be transformed when you upload your portal to a JSON string containing information about the context of the location where this portal is used.

var configJSON = {"c_hash":"47dp0a24e785026a8n8c013j56u45k9"};

Here you can see a reduced sample of the modified string containing your company hash that will be required when making the HTTP request to the API.

 var url = 'https://login.cloudi-fi.net/api/2/register/'+ registration +'?ch='+ configJSON["c_hash"] +'&firstname='+ user.firstname +'&lastname='+ user.lastname +'&guest='+ user.mail +'&input='+ user.sponsor;

We concatenate all our previous elements into the URL of the API with all the required parameters: registration method, company hash, first name, last name, guest email and input which, in this case, is the sponsor mail.

$.get(url,function(data){
  console.log(data);
});

Finally, we make the HTTP request, using the JQuery library get function here, and log the result to the console.

Did this answer your question?