diff --git a/app/Http/Controllers/UserApiTokenController.php b/app/Http/Controllers/UserApiTokenController.php index 9f5ebc49e..c18d52901 100644 --- a/app/Http/Controllers/UserApiTokenController.php +++ b/app/Http/Controllers/UserApiTokenController.php @@ -44,14 +44,14 @@ class UserApiTokenController extends Controller $token = (new ApiToken())->forceFill([ 'name' => $request->get('name'), - 'client_id' => Str::random(32), - 'client_secret' => Hash::make($secret), + 'token_id' => Str::random(32), + 'secret' => Hash::make($secret), 'user_id' => $user->id, 'expires_at' => $expiry ]); - while (ApiToken::query()->where('client_id', '=', $token->client_id)->exists()) { - $token->client_id = Str::random(32); + while (ApiToken::query()->where('token_id', '=', $token->token_id)->exists()) { + $token->token_id = Str::random(32); } $token->save(); diff --git a/database/migrations/2019_12_29_120917_add_api_auth.php b/database/migrations/2019_12_29_120917_add_api_auth.php index c8a1a7781..eff88247f 100644 --- a/database/migrations/2019_12_29_120917_add_api_auth.php +++ b/database/migrations/2019_12_29_120917_add_api_auth.php @@ -19,8 +19,8 @@ class AddApiAuth extends Migration Schema::create('api_tokens', function(Blueprint $table) { $table->increments('id'); $table->string('name'); - $table->string('client_id')->unique(); - $table->string('client_secret'); + $table->string('token_id')->unique(); + $table->string('secret'); $table->integer('user_id')->unsigned()->index(); $table->date('expires_at')->index(); $table->nullableTimestamps(); diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php index 88eb22aa0..b1da5435f 100755 --- a/resources/lang/en/settings.php +++ b/resources/lang/en/settings.php @@ -163,14 +163,14 @@ return [ 'user_api_token_name_desc' => 'Give your token a readable name as a future reminder of its intended purpose.', 'user_api_token_expiry' => 'Expiry Date', 'user_api_token_expiry_desc' => 'Set a date at which this token expires. After this date, requests made using this token will no longer work. Leaving this field blank will set an expiry 100 years into the future.', - 'user_api_token_create_secret_message' => 'Immediately after creating this token a "client id"" & "client secret" will be generated and displayed. The client secret will only be shown a single time so be sure to copy the value to somewhere safe and secure before proceeding.', + 'user_api_token_create_secret_message' => 'Immediately after creating this token a "Token ID"" & "Token Secret" will be generated and displayed. The secret will only be shown a single time so be sure to copy the value to somewhere safe and secure before proceeding.', 'user_api_token_create_success' => 'API token successfully created', 'user_api_token_update_success' => 'API token successfully updated', 'user_api_token' => 'API Token', - 'user_api_token_client_id' => 'Client ID', - 'user_api_token_client_id_desc' => 'This is a non-editable system generated identifier for this token which will need to be provided in API requests.', - 'user_api_token_client_secret' => 'Client Secret', - 'user_api_token_client_secret_desc' => 'This is a system generated secret for this token which will need to be provided in API requests. This will only be displayed this one time so copy this value to somewhere safe and secure.', + 'user_api_token_id' => 'Token ID', + 'user_api_token_id_desc' => 'This is a non-editable system generated identifier for this token which will need to be provided in API requests.', + 'user_api_token_secret' => 'Token Secret', + 'user_api_token_secret_desc' => 'This is a system generated secret for this token which will need to be provided in API requests. This will only be displayed this one time so copy this value to somewhere safe and secure.', 'user_api_token_created' => 'Token Created :timeAgo', 'user_api_token_updated' => 'Token Updated :timeAgo', 'user_api_token_delete' => 'Delete Token', diff --git a/resources/views/users/api-tokens/edit.blade.php b/resources/views/users/api-tokens/edit.blade.php index 0ec9adbe6..821a00d93 100644 --- a/resources/views/users/api-tokens/edit.blade.php +++ b/resources/views/users/api-tokens/edit.blade.php @@ -15,11 +15,11 @@
{{ trans('settings.user_api_token_client_id_desc') }}
+ +{{ trans('settings.user_api_token_id_desc') }}
{{ trans('settings.user_api_token_client_secret_desc') }}
+ +{{ trans('settings.user_api_token_secret_desc') }}