diff --git a/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php b/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php index d1783c3..a6826e2 100644 --- a/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php +++ b/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php @@ -28,8 +28,9 @@ use Carbon\Carbon; use App\Account; use App\ActivationExpiration; use App\Admin; -use App\Rules\WithoutSpaces; +use App\Alias; use App\Http\Controllers\Account\AuthenticateController as WebAuthenticateController; +use App\Rules\WithoutSpaces; class AccountController extends Controller { @@ -80,11 +81,17 @@ class AccountController extends Controller 'algorithm' => 'required|in:SHA-256,MD5', 'password' => 'required|filled', 'domain' => 'min:3', + 'email' => 'email', 'admin' => 'boolean|nullable', 'activated' => 'boolean|nullable', 'confirmation_key_expires' => [ 'date_format:Y-m-d H:i:s', 'nullable', + ], + 'phone' => [ + 'unique:external.aliases,alias', + 'unique:external.accounts,username', + new WithoutSpaces, 'starts_with:+', 'phone:AUTO' ] ]); @@ -123,6 +130,14 @@ class AccountController extends Controller $admin->save(); } + if ($request->has('phone')) { + $alias = new Alias; + $alias->alias = $request->get('phone'); + $alias->domain = config('app.sip_domain'); + $alias->account_id = $account->id; + $alias->save(); + } + // Full reload $account = Account::withoutGlobalScopes()->find($account->id); diff --git a/flexiapi/resources/views/documentation.blade.php b/flexiapi/resources/views/documentation.blade.php index 36851f8..77ddcec 100644 --- a/flexiapi/resources/views/documentation.blade.php +++ b/flexiapi/resources/views/documentation.blade.php @@ -167,6 +167,7 @@ For the moment only DIGEST-MD5 and DIGEST-SHA-256 are supported through the auth
domain optional, the value is set to the default registration domain if not setactivated optional, a boolean, set to false by defaultadmin optional, a boolean, set to false by default, create an admin accountphone optional, a phone number, set a phone number to the accountconfirmation_key_expires optional, a datetime of this format: Y-m-d H:i:s. Only used when activated is not used or false. Enforces an expiration date on the returned confirmation_key. After that datetime public email or phone activation endpoints will return 403.