Add API action to create account

This commit is contained in:
Thibaud Fabre
2015-06-25 17:18:21 +02:00
committed by Aztech
parent 2ebc4e1558
commit 979770953e
5 changed files with 49 additions and 10 deletions

View File

@@ -1911,6 +1911,24 @@ class API_V1_adapter extends API_V1_Abstract
return $grants;
}
public function create_account(array $data)
{
/** @var \Alchemy\Phrasea\Authentication\RegistrationService $service */
$service = $this->app['authentication.registration_service'];
$user = $service->registerUser($data);
$token = $service->getAccountUnlockToken($user);
$result = new API_V1_result($this->app, $this->app['request'], $this);
$result->set_datas(array(
'user' => $this->list_user($user),
'token' => $token
));
return $result;
}
/**
* Resets the password for a given email address
*