mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-04-17 19:58:27 +00:00
Allow phone numbers to be set on the admin account creation API endpoint
This commit is contained in:
parent
13d5a2410a
commit
9cf86e1b6a
3 changed files with 18 additions and 2 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ For the moment only DIGEST-MD5 and DIGEST-SHA-256 are supported through the auth
|
|||
<li><code>domain</code> optional, the value is set to the default registration domain if not set</li>
|
||||
<li><code>activated</code> optional, a boolean, set to <code>false</code> by default</li>
|
||||
<li><code>admin</code> optional, a boolean, set to <code>false</code> by default, create an admin account</li>
|
||||
<li><code>phone</code> optional, a phone number, set a phone number to the account</li>
|
||||
<li><code>confirmation_key_expires</code> optional, a datetime of this format: Y-m-d H:i:s. Only used when <code>activated</code> is not used or <code>false</code>. Enforces an expiration date on the returned <code>confirmation_key</code>. After that datetime public email or phone activation endpoints will return <code>403</code>.</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue