Supporting account activation by Email

Created: 12/26/2016 | Updated: 8/23/2018 | Status: Published

If your site is set to activate user account with activation Email this is what you need to do in your content site:

1.  Create a dedicated page in your content site for account activation (we will link the user to this page in the activation email he gets after registration)

2. Fetch the Token parameter value from the url

3. Create an api call that will confirm the user in Trade smarter system by passing the token parameter value to the API


here is a basic PHP code example for the API call you should use:


<?php

// Init cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

// Set HTTP Auth credentials
curl_setopt($ch, CURLOPT_USERPWD, 'user:password');

$hashToken = "get token from email/url";

// token
$token_data = array(
    'token' => $hashToken
);

curl_setopt($ch, CURLOPT_URL, 'https://platform-api.tradesmarter.com/index/confirm');
curl_setopt($ch, CURLOPT_POSTFIELDS, $token_data);
$result = curl_exec($ch);
echo "Result: " . $result . "<br />";

?>

this way the user will be activated in your trading platfrom