mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-15 09:57:41 +01:00
Add ability to name the client
This commit is contained in:
parent
eb570e49c8
commit
a8d3fe50df
@ -28,13 +28,14 @@ class UserRestController extends WallabagRestController
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an user.
|
||||
* Register an user and create a client.
|
||||
*
|
||||
* @ApiDoc(
|
||||
* requirements={
|
||||
* {"name"="username", "dataType"="string", "required"=true, "description"="The user's username"},
|
||||
* {"name"="password", "dataType"="string", "required"=true, "description"="The user's password"},
|
||||
* {"name"="email", "dataType"="string", "required"=true, "description"="The user's email"}
|
||||
* {"name"="email", "dataType"="string", "required"=true, "description"="The user's email"},
|
||||
* {"name"="client_name", "dataType"="string", "required"=true, "description"="The client name (to be used by your app)"}
|
||||
* }
|
||||
* )
|
||||
*
|
||||
@ -100,7 +101,7 @@ class UserRestController extends WallabagRestController
|
||||
|
||||
// create a default client
|
||||
$client = new Client($user);
|
||||
$client->setName('Default client');
|
||||
$client->setName($request->request->get('client_name', 'Default client'));
|
||||
|
||||
$this->getDoctrine()->getManager()->persist($client);
|
||||
|
||||
|
@ -85,6 +85,7 @@ class UserRestControllerTest extends WallabagApiTestCase
|
||||
'username' => 'google',
|
||||
'password' => 'googlegoogle',
|
||||
'email' => 'wallabag@google.com',
|
||||
'client_name' => 'My client name !!',
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $client->getResponse()->getStatusCode());
|
||||
@ -104,7 +105,7 @@ class UserRestControllerTest extends WallabagApiTestCase
|
||||
$this->assertArrayHasKey('client_secret', $content['default_client']);
|
||||
$this->assertArrayHasKey('client_id', $content['default_client']);
|
||||
|
||||
$this->assertEquals('Default client', $content['default_client']['name']);
|
||||
$this->assertEquals('My client name !!', $content['default_client']['name']);
|
||||
|
||||
$this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user