Skip to content

Commit 989f2f8

Browse files
committed
Ensure fields autoselect. closes #2
1 parent 1dcc3e9 commit 989f2f8

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

wp-admin/css/key-pair.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
margin-top: 1px;
2929
}
3030

31-
.new-key-pair-token kbd {
31+
.input-select {
3232
display: block;
33-
margin-bottom: 1.5em;
34-
overflow-wrap: break-word;
35-
padding: 1em;
33+
font-family: monospace;
34+
margin: .6em 0 1.2em;
35+
width: 100%;
3636
}
3737

3838
input[name=new_token_api_secret] {
3939
width: 100%;
4040
margin-bottom: 1.2em;
41-
}
41+
}

wp-admin/js/key-pair.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@
155155
}
156156
} );
157157

158+
$( document ).on( 'click', '.input-select', function() {
159+
$( this ).select();
160+
} );
161+
158162
$( document ).on( 'click', '.key-pair-modal-dismiss', function( e ) {
159163
e.preventDefault();
160164

wp-includes/rest-api/auth/class-wp-rest-key-pair.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ public function template_new_key_pair() {
677677
printf(
678678
/* translators: %s: key-pair api_secret */
679679
esc_html_x( 'Your new API secret password is: %s', 'API key-pair', 'jwt-auth' ),
680-
'<kbd>{{ data.api_secret }}</kbd>'
680+
'<input type="text" value="{{ data.api_secret }}" class="input-select" />'
681681
);
682682
?>
683683
</div>
@@ -734,14 +734,14 @@ public function template_new_token_key_pair() {
734734
printf(
735735
/* translators: %s: JSON Web Token */
736736
esc_html_x( 'Your new access token is: %s', 'Access Token', 'jwt-auth' ),
737-
'<kbd>{{ data.access_token }}</kbd>'
737+
'<input type="text" value="{{ data.access_token }}" class="input-select" />'
738738
);
739739
?>
740740
<?php
741741
printf(
742742
/* translators: %s: JSON Web Token */
743743
esc_html_x( 'Your new refresh token is: %s', 'Refresh Token', 'jwt-auth' ),
744-
'<kbd>{{ data.refresh_token }}</kbd>'
744+
'<input type="text" value="{{ data.refresh_token }}" class="input-select" />'
745745
);
746746
?>
747747
<p><?php esc_attr_e( 'Be sure to save these JSON Web Tokens in a safe location, you will not be able to retrieve them ever again. Once you click dismiss they\'re gone forever.', 'jwt-auth' ); ?></p>

0 commit comments

Comments
 (0)