mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Added refresh method to API
This commit is contained in:
parent
acbe5912ae
commit
83a106142f
@ -85,12 +85,20 @@ class AccountApiController extends BaseAPIController
|
||||
}
|
||||
}
|
||||
|
||||
private function processLogin(Request $request)
|
||||
public function refresh(Request $request)
|
||||
{
|
||||
return $this->processLogin($request, false);
|
||||
}
|
||||
|
||||
private function processLogin(Request $request, $createToken = true)
|
||||
{
|
||||
// Create a new token only if one does not already exist
|
||||
$user = Auth::user();
|
||||
$account = $user->account;
|
||||
$this->accountRepo->createTokens($user, $request->token_name);
|
||||
|
||||
if ($createToken) {
|
||||
$this->accountRepo->createTokens($user, $request->token_name);
|
||||
}
|
||||
|
||||
$users = $this->accountRepo->findUsers($user, 'account.account_tokens');
|
||||
$transformer = new UserAccountTransformer($account, $request->serializer, $request->token_name);
|
||||
|
@ -7,6 +7,7 @@ Route::post('register', 'AccountApiController@register');
|
||||
Route::get('static', 'AccountApiController@getStaticData');
|
||||
Route::get('accounts', 'AccountApiController@show');
|
||||
Route::put('accounts', 'AccountApiController@update');
|
||||
Route::post('refresh', 'AccountApiController@refresh');
|
||||
|
||||
Route::resource('clients', 'ClientApiController');
|
||||
Route::resource('contacts', 'ContactApiController');
|
||||
|
Loading…
Reference in New Issue
Block a user