You can choose to let your users register themselves with a phone number. They will then receive a text message containing the password.
Here is how it looks like from the user perspective:

This is the portal landing page where the user can enter his phone number and optional fields like his or her name.

Behind the scenes, when clicking the button an API call will be made to generate the credentials for this user and send a text message containing the password to the provided phone number.

Then by going back and choosing the login button, he can fill in the form with his phone number and the password he or she received.

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="mobile"> 

Integrate the phone registration in your portal template

To let your users register with their phone number, 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 = {
  phone:'33612345678',
  firstname:'John',
  lastname:'Doe'
};

var registration = 'mobile';

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 +'&input='+ user.phone;

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

Let's dive into this step by step:

var user = {
  phone:'33612345678',
  firstname:'John',
  lastname:'Doe'
};

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 = 'mobile';

We declare a variable with the registration method you want for your portal, in this case, 'mobile' means the user self-register and will receive his credentials the phone number he provided.

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 +'&input='+ user.phone;

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, and input which, in this case, is the user phone number.

$.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?