Commit 011e2fa9 authored by Timothée Jaussoin's avatar Timothée Jaussoin
Browse files

Handle acccount aliases in the admin account creation API endpoint

parent 2a4c4978
......@@ -197,13 +197,23 @@ FlexiAPIClient *FlexiAPIClient::adminAccountCreate(string username, string passw
FlexiAPIClient *FlexiAPIClient::adminAccountCreate(string username, string password, string algorithm, string domain,
bool activated, string email) {
return adminAccountCreate(username, password, algorithm, domain, activated, email, "");
}
FlexiAPIClient *FlexiAPIClient::adminAccountCreate(string username, string password, string algorithm, string domain,
bool activated, string email, string phone) {
JsonParams params;
params.push("username", username);
params.push("password", password);
params.push("email", email);
params.push("algorithm", algorithm);
params.push("activated", to_string(activated));
if (!email.empty()) {
params.push("email", email);
}
if (!phone.empty()) {
params.push("phone", phone);
}
if (!domain.empty()) {
params.push("domain", domain);
}
......
......@@ -109,6 +109,8 @@ class LINPHONE_PUBLIC FlexiAPIClient : public enable_shared_from_this<FlexiAPICl
bool activated);
FlexiAPIClient *adminAccountCreate(string username, string password, string algorithm, string domain,
bool activated, string email);
FlexiAPIClient *adminAccountCreate(string username, string password, string algorithm, string domain,
bool activated, string email, string phone);
FlexiAPIClient *adminAccounts();
FlexiAPIClient *adminAccount(int id);
FlexiAPIClient *adminAccountDelete(int id);
......
......@@ -449,8 +449,12 @@ LinphoneAccountCreatorStatus linphone_account_creator_admin_create_account_flexi
auto flexiAPIClient = make_shared<FlexiAPIClient>(creator->core);
string phone = (creator->phone_number)
? creator->phone_number
: "";
flexiAPIClient->setTest(TRUE)
->adminAccountCreate(creator->username, creator->password, "MD5", creator->domain, true, creator->email)
->adminAccountCreate(creator->username, creator->password, "MD5", creator->domain, true, creator->email, phone)
->then([creator](FlexiAPIClient::Response response) {
NOTIFY_IF_EXIST_ACCOUNT_CREATOR(create_account, creator, LinphoneAccountCreatorStatusAccountCreated,
response.body.c_str());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment