Ensure that the confirmation code is also generated when activated is set to false during the account creation process

Bump the package number
This commit is contained in:
Timothée Jaussoin 2021-01-18 17:54:29 +01:00
parent a82d66bc48
commit cda7864c52
3 changed files with 31 additions and 2 deletions

View file

@ -90,7 +90,7 @@ class AccountController extends Controller
$account->creation_time = Carbon::now();
$account->user_agent = config('app.name');
if (!$request->has('activated') || !(bool)$request->has('activated')) {
if (!$request->has('activated') || !(bool)$request->get('activated')) {
$account->confirmation_key = Str::random(WebAuthenticateController::$emailCodeSize);
}

View file

@ -183,6 +183,35 @@ class AccountApiTest extends TestCase
$this->assertTrue(empty($response1['confirmation_key']));
}
public function testNotActivated()
{
$admin = Admin::factory()->create();
$admin->account->generateApiKey();
$password = $admin->account->passwords()->first();
$username = 'username';
$response0 = $this->generateFirstResponse($password);
$response1 = $this->generateSecondResponse($password, $response0)
->json($this->method, $this->route, [
'username' => $username,
'algorithm' => 'SHA-256',
'password' => '2',
'activated' => false,
]);
$response1
->assertStatus(200)
->assertJson([
'id' => 2,
'username' => $username,
'domain' => config('app.sip_domain'),
'activated' => false,
]);
$this->assertFalse(empty($response1['confirmation_key']));
}
public function testSimpleAccount()
{
$password = Password::factory()->create();

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 43
%define build_number 44
%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"