Open Registration

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsOpen Registration
(Created page with "### Tutorial DreamFactory 2.0 support open user registration. By default it is disabled. To enable it, log into the admin console, click on the services tab and select the u...")
Line 1: Line 1:
 
### Tutorial
 
### Tutorial
  
DreamFactory 2.0 support open user registration. By default it is disabled. To enable it, log into the admin console,  
+
DreamFactory 2.0 supports open registration. By default it is disabled. To enable it, log into the admin console,  
 
click on the services tab and select the user service. On the user service details page, click on the config tab. Check  
 
click on the services tab and select the user service. On the user service details page, click on the config tab. Check  
off the 'Allow Open Registration' checkbox there. On this config page you can also select a role in the 'Open Reg Role Id'  
+
off the 'Allow Open Registration' checkbox there. On this config page you can also select a role in the 'Open Reg Role'  
field. This role will be used for all your self-registered users. If you would like your users to be verified using email  
+
field. This role will be used for all your self-registered users. If you would like to require your users to be verified using email  
confirmation then select an email service in the 'Open Reg Email Service Id' field. Choose an email template for your  
+
confirmation then select an email service in the 'Open Reg Email Service' field. Choose an email template for your  
confirmation email in the 'Open Reg Email Template Id' field. If you do not choose an email service for Open Registration,  
+
confirmation email in the 'Open Reg Email Template' field. If you do not choose an email service for Open Registration,  
 
your users will be forced to choose their password during registration.
 
your users will be forced to choose their password during registration.
  
Line 31: Line 31:
 
{
 
{
 
   "email": "[email protected]",
 
   "email": "[email protected]",
   "first_name": "John",  
+
   "first_name": "John",
 
   "last_name": "Doe"
 
   "last_name": "Doe"
 
}
 
}
Line 44: Line 44:
 
</source>
 
</source>
  
### Example - Open Registration and login when email confirmation is required.  
+
### Example - Open Registration and Login when email confirmation is required.  
  
 
* Request body:
 
* Request body:
Line 50: Line 50:
 
{
 
{
 
   "email": "[email protected]",
 
   "email": "[email protected]",
   "first_name": "John",  
+
   "first_name": "John",
 
   "last_name": "Doe"
 
   "last_name": "Doe"
 
}
 
}
Line 74: Line 74:
 
   "email": "[email protected]",
 
   "email": "[email protected]",
 
   "password":"secret",
 
   "password":"secret",
   "first_name": "John",  
+
   "first_name": "John",
 
   "last_name": "Doe"
 
   "last_name": "Doe"
 
}
 
}
Line 87: Line 87:
 
</source>
 
</source>
  
### Example - Open Registration and login when email confirmation is turned off.  
+
### Example - Open Registration and Login when email confirmation is turned off.  
  
 
* Request body:
 
* Request body:
Line 94: Line 94:
 
   "email": "[email protected]",
 
   "email": "[email protected]",
 
   "password":"secret",
 
   "password":"secret",
   "first_name": "John",  
+
   "first_name": "John",
 
   "last_name": "Doe"
 
   "last_name": "Doe"
 
}
 
}

Revision as of 20:37, 13 October 2015

      1. Tutorial

DreamFactory 2.0 supports open registration. By default it is disabled. To enable it, log into the admin console, click on the services tab and select the user service. On the user service details page, click on the config tab. Check off the 'Allow Open Registration' checkbox there. On this config page you can also select a role in the 'Open Reg Role' field. This role will be used for all your self-registered users. If you would like to require your users to be verified using email confirmation then select an email service in the 'Open Reg Email Service' field. Choose an email template for your confirmation email in the 'Open Reg Email Template' field. If you do not choose an email service for Open Registration, your users will be forced to choose their password during registration.

Tutorial open registration1.png

      1. API Endpoint
POST https://{url}/api/v2/user/register?login={bool}

Request body:

{
  "email": "user_email",        //Required field.
  "password": "password",       //Required only when no Open Registration Email Service is selected.
  "first_name": "first_name",
  "last_name": "last_name"      //Required field.
}


      1. Example - Open Registration when email confirmation is required.
  • Request body:
{
  "email": "[email protected]",
  "first_name": "John",
  "last_name": "Doe"
}
  • Request URL:
POST https://foo.com/api/v2/user/register
  • Response
{
    "success":true
}
      1. Example - Open Registration and Login when email confirmation is required.
  • Request body:
{
  "email": "[email protected]",
  "first_name": "John",
  "last_name": "Doe"
}
  • Request URL:
POST https://foo.com/api/v2/user/register?login=true
  • Response
{
    "success":true,
    "confirmation_required": true
}

> _Note: Forcing login during open registration will not work when email confirmation is required. Therefore, response > includes "confirmation_required":true._

      1. Example - Open Registration when email confirmation is turned off.
  • Request body:
{
  "email": "[email protected]",
  "password":"secret",
  "first_name": "John",
  "last_name": "Doe"
}
  • Request URL:
POST https://foo.com/api/v2/user/register
  • Response
{
    "success":true
}
      1. Example - Open Registration and Login when email confirmation is turned off.
  • Request body:
{
  "email": "[email protected]",
  "password":"secret",
  "first_name": "John",
  "last_name": "Doe"
}
  • Request URL:
POST https://foo.com/api/v2/user/register?login=true
  • Response
{
	"success": true,
	"session_token": "abc.123.efg"
}