Skip to content

Commit a84b9a1

Browse files
committed
Update UI to handle new refresh token
1 parent a822124 commit a84b9a1

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

wp-admin/js/key-pair.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@
117117
$keyPairSection.after( tmplNewTokenKeyPair( {
118118
name: name,
119119
api_key: apiKey,
120-
access_token: response.access_token
120+
access_token: response.access_token,
121+
refresh_token: response.refresh_token
121122
} ) );
122123

123124
$( document ).on( 'click', '.key-pair-token-download', function( event ) {

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ public function template_new_token_key_pair() {
707707
<# if ( data.message ) { #>
708708
<div class="notice notice-error"><p>{{{ data.message }}}</p></div>
709709
<# } #>
710-
<# if ( ! data.access_token ) { #>
710+
<# if ( ! data.access_token || ! data.refresh_token ) { #>
711711
<p>
712712
<?php
713713
printf(
@@ -733,11 +733,18 @@ public function template_new_token_key_pair() {
733733
<?php
734734
printf(
735735
/* translators: %s: JSON Web Token */
736-
esc_html_x( 'Your new JSON Web Token is: %s', 'JSON Web Token', 'jwt-auth' ),
736+
esc_html_x( 'Your new access token is: %s', 'Access Token', 'jwt-auth' ),
737737
'<kbd>{{ data.access_token }}</kbd>'
738738
);
739739
?>
740-
<p><?php esc_attr_e( 'Be sure to save this JSON Web Token in a safe location, you will not be able to retrieve it ever again. Once you click dismiss it is gone forever.', 'jwt-auth' ); ?></p>
740+
<?php
741+
printf(
742+
/* translators: %s: JSON Web Token */
743+
esc_html_x( 'Your new refresh token is: %s', 'Refresh Token', 'jwt-auth' ),
744+
'<kbd>{{ data.refresh_token }}</kbd>'
745+
);
746+
?>
747+
<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 is gone forever.', 'jwt-auth' ); ?></p>
741748
</div>
742749
<button class="button button-secondary key-pair-token-download"><?php esc_attr_e( 'Download', 'jwt-auth' ); ?></button>
743750
<# } #>

0 commit comments

Comments
 (0)