Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
branding_api [2014/06/13 17:13]
ybarajas
branding_api [2014/06/13 17:20] (current)
ybarajas [Prerequisites]
Line 1: Line 1:
 +=======Branding======
  
 +The branding API described below allows you to brand Hosted Authentication-related material (company logo, header, footer,​etc.) using canned code.
 +
 +=====Prerequisites=====
 +
 +  * **IT Billable** set-up must be selected.
 +  * **Allow Self-Registration** must be enabled.
 +  * **Allowed Email Domains** must be specified.
 +
 +For more details on fulfilling the perquisites listed above, please contact Customer Care.
 +
 +
 +----
 +
 +**1.** Include the iPass Javascript library in the header section.
 +
 +<​code>​
 +<​head>​
 +  <script type="​text/​javascript"​ src="​http://​openmobile.ipass.com/​euservices/​api/​all-classes.js"></​script>​
 +</​head>​
 +</​code>​
 +
 +**2.** Include the attribute **ipass-data** in the input element of the form. For self-registration,​ the following fields are mandatory:
 +
 +  * First Name:  ipass-data=”firstName”
 +  * Last Name:   ​ipass-data=”lastName”
 +  * Username: ​   ipass-data=”username”
 +  * Email: ​      ​ipass-data=”email”
 +  * CompanyId: ​  ​ipass-data="​companyId"​
 +
 +<​note>​Make the companyId field "​hidden,"​ if you do not want users to see it.</​note>​
 +
 +==Example==
 +
 +<​code>​
 +<form id="​register_form">​
 +  <div>
 +   <​label>​
 +    <​span>​FirstName</​span>​
 +    <​inputtype="​text"​size="​20"​ipass-data="​firstName"/>  ​
 +   </​label>​
 +  </​div>​
 +
 +  <div>
 +   <​label>​
 +    <​span>​LastName</​span>​
 +    <​inputtype="​text"​size="​20"​ipass-data="​lastName"/>​
 +   </​label>​
 +  </​div>​
 +  ​
 +  <div>
 +   <​label>​
 +    <​span>​WorldwideID</​span>​
 +    <​inputtype="​text"​size="​20"​ipass-data="​username"/>​
 +   </​label>​
 +  </​div>​
 +
 +  <div>
 +   <​label>​
 +    <​span>​Email</​span>​
 +    <​inputtype="​text"​size="​20"​ipass-data="​email"/>​
 +   </​label>​
 +  </​div>​
 +  ​
 +  <input type="​hidden"​size="​20"​ipass-data="​companyId"​ value="​001"/>​
 +</​form>​
 +</​code>​
 +
 +
 +**3.** Create an event handler which listens to an **onclick** event on the button or **onsubmit** event on the form.
 +
 +<​code>​
 +<​formid="​register_form">​
 +  ...
 +  <button type="​submit"​onclick="​doRegister()"​SignOn</​button>​
 +  ...
 +</​form>​
 +</​code>​
 +
 +**4.** Inside the event handler, call iPass **register** function and pass the id of the form and name of the callback function, like **responseHandler** as show in the example.
 +
 +<​code>​
 +<​head>​
 +  <​script>​
 +   ​functiondoRegister(){
 +    Ipass.register("​register_form",​ responseHandler);​
 +   }
 +  </​script>​
 + </​head>​
 +</​code>​
 +
 +
 +**5.** Declare the callback function. The response from iPass will be passed to the **response** argument. ​
 +
 +<​code>​
 +function responseHandler(response){
 +         if (response.success){
 +         ...
 +         }
 +         else{
 +                var errorMsg = ";
 +                for (var i=0;<​response.error.length;​i++){
 +                         ​errorMsg = errorMsg + response.error[i].errorCode+';';​
 +                         
 +                }
 +                alert('​errorMsg = ' + errorMsg);
 +          }
 +}
 +
 +</​code>​
 +
 +**Response in XML format:**
 +
 +__In successful case__:
 +
 +<​code>​
 +  <​selfRegistrationStatus>​
 +         <​errors></​errors>​
 +         <​status><​Success</​status>​
 +  </​selfRegistrationStatus>​
 +</​code>​
 +
 +__In failed case__:
 +
 +<​code> ​  
 +   <​selfRegistrationStatus>​
 +          <​errors>​
 +                 <​error>​
 +                       <​errorCode>​EmailAlreadyRegistered</​errorCode>​
 +                       <​fieldName>​email</​fieldName>​
 +                       <​message>​Sorry! The email joe.smith@gmail.com is already taken.</​message>​
 +                 </​error>​
 +          </​errors>​
 +          <​status>​Error</​status>​
 +   <​selfRegistrationStatus>​
 +   
 +</​code>​
 +
 +In case of failure, the error information will be contained in an **error** element which includes an **errorCode**,​ **fieldName**,​ and **message** of the error. Based on **errorCode**,​ you can customize your error message. The following is the list of **errorCode** options:
 +
 +  * InvalidCharsFName
 +  * InvalidCharsLName
 +  * InvalidCharsEmail
 +  * InvalidFormatEmail
 +  * MaxCharsFName
 +  * MaxCharsLName
 +  * MaxCharsEmail
 +  * MaxCharsUsername
 +  * MaxCharsDepartmentCode
 +  * MinCharsEmail
 +  * MinCharsUsername
 +  * EmailUnavailable
 +  * EmailAlreadyRegistered
 +  * UsernameMultipleAt
 +  * FirstnameNotPresent
 +  * LastnameNotPresent
 +  * EmailNotPresent
 +  * UsernameNotPresent
 +  * CompanyNotPresent
 +  * CompanyNotFound
 +  * SelfRegistrationNotAllowed
 +  * NoDomainConfiguredCompany
 +  * UnknownError
 +       
 +       
 +Go to: **[[:​start|Portal Home]]** > **[[:​api_documentation|REST API Overview]]**
 

©2015 iPass Inc. All rights reserved. Terms of Use