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 set
  • activated optional, a boolean, set to false by default
  • admin optional, a boolean, set to false by default, create an admin account
  • +
  • phone optional, a phone number, set a phone number to the account
  • confirmation_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.
  • diff --git a/flexisip-account-manager.spec b/flexisip-account-manager.spec index 84675bf..b0fc9c9 100644 --- a/flexisip-account-manager.spec +++ b/flexisip-account-manager.spec @@ -8,7 +8,7 @@ #%define _datadir %{_datarootdir} #%define _docdir %{_datadir}/doc -%define build_number 60 +%define build_number 61 %define var_dir /var/opt/belledonne-communications %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager %define env_file "$RPM_BUILD_ROOT/etc/flexisip-account-manager/flexiapi.env"