From 48e7b56d9a6e4211d24e2ddf936f3d3cf0f4558c Mon Sep 17 00:00:00 2001 From: smarcet Date: Sat, 29 Feb 2020 01:06:03 -0300 Subject: [PATCH] Added copy 2 clipboard feature on OAUTH2 Client Data Change-Id: Ie6ec98a491ff543c71e2f2c396b5653a2917faea Signed-off-by: smarcet --- .gitignore | 1 + app/Services/OAuth2/TokenService.php | 2 +- package-lock.json | 46 +++++++++++---- package.json | 1 + public/assets/css/main.css | 6 ++ .../js/oauth2/profile/edit-client-data.js | 2 +- .../oauth2/profile/edit-client-data.blade.php | 56 +++++++++++++++++-- webpack.config.js | 1 + 8 files changed, 98 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index c0d52e43..c5b5190b 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ public/assets/css/index.css /public/assets/sweetalert2/ /public/assets/urijs /public/assets/uri.js +/public/assets/clipboard-copy-element/ _intellij_phpdebug_validator.php /public/assets/chosen-js /public/assets/moment diff --git a/app/Services/OAuth2/TokenService.php b/app/Services/OAuth2/TokenService.php index a2441c0b..24d5229d 100644 --- a/app/Services/OAuth2/TokenService.php +++ b/app/Services/OAuth2/TokenService.php @@ -1184,7 +1184,7 @@ final class TokenService extends AbstractService implements ITokenService foreach($client->getRefreshTokens() as $rt) { - $this->markRefreshTokenAsRevoked($rt); + $this->markRefreshTokenAsRevoked($rt->getValue()); } $client->removeAllAccessTokens(); diff --git a/package-lock.json b/package-lock.json index caf7e4e1..c719d128 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,11 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@github/clipboard-copy-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@github/clipboard-copy-element/-/clipboard-copy-element-1.1.2.tgz", + "integrity": "sha512-L6CMrcA5we0udafvoSuRCE/Ci/3xrLWKYRGup2IlhxF771bQYsQ2EB1of182pI8ZWM4oxgwzu37+igMeoZjN/A==" + }, "@gulp-sourcemaps/map-sources": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@gulp-sourcemaps/map-sources/-/map-sources-1.0.0.tgz", @@ -3828,7 +3833,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3846,11 +3852,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3863,15 +3871,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3974,7 +3985,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3984,6 +3996,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3996,17 +4009,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -4023,6 +4039,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4101,7 +4118,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4111,6 +4129,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4186,7 +4205,8 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4216,6 +4236,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4233,6 +4254,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4271,11 +4293,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.3", - "bundled": true + "bundled": true, + "optional": true } } }, diff --git a/package.json b/package.json index b0c9984c..28e232ca 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "url-loader": "^0.6.2" }, "dependencies": { + "@github/clipboard-copy-element": "^1.1.2", "bootstrap": "^3.3.7", "bootstrap-datepicker": "^1.8.0", "bootstrap-sass": "^3.0.0", diff --git a/public/assets/css/main.css b/public/assets/css/main.css index 6c6d96c1..96757e53 100644 --- a/public/assets/css/main.css +++ b/public/assets/css/main.css @@ -339,4 +339,10 @@ span.help-block::before { margin-bottom: 10px; font-size: 12px; color: #aaa; +} + +.input-group-button { + width: 1%; + vertical-align: middle; + display:table-cell; } \ No newline at end of file diff --git a/public/assets/js/oauth2/profile/edit-client-data.js b/public/assets/js/oauth2/profile/edit-client-data.js index dddc65f6..a7c961dc 100644 --- a/public/assets/js/oauth2/profile/edit-client-data.js +++ b/public/assets/js/oauth2/profile/edit-client-data.js @@ -123,7 +123,7 @@ jQuery(document).ready(function($){ timeout:60000, success: function (data,textStatus,jqXHR) { //load data... - $('#client_secret').text(data.client_secret); + $('#client_secret > :input').val(data.client_secret); //$('#client_secret_expiration_date').text(data.new_expiration_date.date); //clean token UI $('#table-access-tokens').remove(); diff --git a/resources/views/oauth2/profile/edit-client-data.blade.php b/resources/views/oauth2/profile/edit-client-data.blade.php index f7752028..20406b44 100644 --- a/resources/views/oauth2/profile/edit-client-data.blade.php +++ b/resources/views/oauth2/profile/edit-client-data.blade.php @@ -8,7 +8,26 @@
- {!! $client->client_id !!} +
+ +
+ + + +
+
+
@if($client->client_type == OAuth2\Models\IClient::ClientType_Confidential) @@ -16,10 +35,29 @@
- {!! $client->client_secret !!} @if ($client->isOwner(Auth::user())) - {!! HTML::link(URL::action("Api\\ClientApiController@regenerateClientSecret",array("id"=>$client->id)),'Regenerate',array('class'=>'btn btn-default btn-md active regenerate-client-secret','title'=>'Regenerates Client Secret')) !!} + {!! HTML::link(URL::action("Api\\ClientApiController@regenerateClientSecret",array("id"=>$client->id)),'Regenerate',array('class'=>'btn btn-default btn-xs active regenerate-client-secret','title'=>'Regenerates Client Secret')) !!} @endif +
+ +
+ + + +
+
@endif @@ -141,5 +179,15 @@ @section('scripts') - {!! HTML::script('assets/js/oauth2/profile/edit-client-data.js') !!} + {!! HTML::script('assets/clipboard-copy-element/index.umd.js')!!} + {!! HTML::script('assets/js/oauth2/profile/edit-client-data.js') !!}' + @append \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 75c91041..4986a561 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -41,6 +41,7 @@ var plugins = [ {from: './node_modules/urijs/src', to: 'urijs'}, {from: './node_modules/chosen-js', to: 'chosen-js'}, {from: './node_modules/moment', to: 'moment'}, + {from: './node_modules/@github/clipboard-copy-element/dist', to: 'clipboard-copy-element'}, ], {copyUnmodified: false} ),