mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 10:08:05 +00:00
Fix FLEXIAPI-142
This commit is contained in:
parent
07f8a6e7dd
commit
7ce7c85184
2 changed files with 16 additions and 5 deletions
|
|
@ -30,13 +30,13 @@ class UpdateAccountRequest extends FormRequest
|
|||
new SIPUsername,
|
||||
Rule::unique('accounts', 'username')->where(function ($query) {
|
||||
$query->where('domain', resolveDomain($this));
|
||||
})->ignore($this->route('account_id'), 'id'),
|
||||
})->ignore($this->route('id'), 'id'),
|
||||
'filled',
|
||||
],
|
||||
'email' => [
|
||||
'nullable',
|
||||
'email',
|
||||
config('app.account_email_unique') ? Rule::unique('accounts', 'email')->ignore($this->route('account_id')) : null
|
||||
config('app.account_email_unique') ? Rule::unique('accounts', 'email')->ignore($this->route('id')) : null
|
||||
],
|
||||
'role' => 'in:admin,end_user',
|
||||
'dtmf_protocol' => 'nullable|in:' . Account::dtmfProtocolsRule(),
|
||||
|
|
@ -44,8 +44,8 @@ class UpdateAccountRequest extends FormRequest
|
|||
'nullable',
|
||||
Rule::unique('accounts', 'username')->where(function ($query) {
|
||||
$query->where('domain', resolveDomain($this));
|
||||
})->ignore($this->route('account_id'), 'id'),
|
||||
Rule::unique('aliases', 'alias')->ignore($this->route('account_id'), 'account_id'),
|
||||
})->ignore($this->route('id'), 'id'),
|
||||
Rule::unique('aliases', 'alias')->ignore($this->route('id'), 'account_id'),
|
||||
new WithoutSpaces, 'starts_with:+'
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -618,6 +618,7 @@ class ApiAccountTest extends TestCase
|
|||
$username = 'changed';
|
||||
$algorithm = 'MD5';
|
||||
$password = 'other';
|
||||
$newDisplayName = 'new_display_name';
|
||||
|
||||
$this->keyAuthenticated($admin->account)
|
||||
->json('PUT', $this->route . '/1234')
|
||||
|
|
@ -629,6 +630,15 @@ class ApiAccountTest extends TestCase
|
|||
])
|
||||
->assertStatus(422);
|
||||
|
||||
$this->keyAuthenticated($admin->account)
|
||||
->json('PUT', $this->route . '/' . $account->id, [
|
||||
'username' => $username,
|
||||
'algorithm' => $algorithm,
|
||||
'password' => $password,
|
||||
'display_name' => $newDisplayName
|
||||
])
|
||||
->assertStatus(200);
|
||||
|
||||
$this->keyAuthenticated($admin->account)
|
||||
->json('PUT', $this->route . '/' . $account->id, [
|
||||
'username' => $username,
|
||||
|
|
@ -639,7 +649,8 @@ class ApiAccountTest extends TestCase
|
|||
|
||||
$this->assertDatabaseHas('accounts', [
|
||||
'id' => $account->id,
|
||||
'username' => $username
|
||||
'username' => $username,
|
||||
'display_name' => null
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('passwords', [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue