@@ -2,11 +2,13 @@ import React from 'react';
2
2
import PropTypes from 'prop-types' ;
3
3
4
4
import { autobind } from '../helpers' ;
5
+ import { INSUFFICIENT } from '../shared/keytar-strategy' ;
5
6
6
7
export default class GithubLoginView extends React . Component {
7
8
static propTypes = {
8
9
children : PropTypes . node ,
9
10
onLogin : PropTypes . func ,
11
+ tokenStatus : PropTypes . symbol ,
10
12
}
11
13
12
14
static defaultProps = {
@@ -15,6 +17,7 @@ export default class GithubLoginView extends React.Component {
15
17
< span > Log in to GitHub to access PR information and more!</ span >
16
18
</ div > ,
17
19
onLogin : token => { } ,
20
+ tokenStatus : Symbol ( ) ,
18
21
}
19
22
20
23
constructor ( props , context ) {
@@ -57,22 +60,34 @@ export default class GithubLoginView extends React.Component {
57
60
) ;
58
61
}
59
62
63
+ renderTokenHint ( ) {
64
+ if ( this . props . tokenStatus === INSUFFICIENT ) {
65
+ return ( < span > Hint: Entered token has insufficient scopes. Update the scopes on your token and try again. See Dev Tools console for details.</ span > ) ;
66
+ }
67
+ }
68
+
60
69
renderTokenInput ( ) {
70
+ const tokenHint = this . renderTokenHint ( ) ;
71
+
61
72
return (
62
73
< form className = "github-GithubLoginView-Subview" onSubmit = { this . handleSubmitToken } >
63
74
< div className = "github-GitHub-LargeIcon icon icon-mark-github" />
64
75
< h1 > Enter Token</ h1 >
65
76
< ol >
66
77
< li >
67
- Visit < a href = "https://github.com/settings/tokens" > github.com/settings/tokens</ a > to generate a new
68
- Personal Access Token (classic).< sup > < a href = "https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic" > [docs]</ a > </ sup >
78
+ Visit < a href = "https://github.com/settings/tokens/new?scopes=repo,workflow,user:email,read:org& description = Pulsar % 20 github % 20 package " >
79
+ github.com/settings/tokens
80
+ </ a > to generate a new Personal Access Token (classic).
81
+ < sup > < a href = "https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic" > [docs]</ a > </ sup >
69
82
</ li >
70
83
< li >
71
84
Ensure it has the following permissions: < code > repo</ code > , < code > workflow</ code > , < code > read:org</ code > , and < code > user:email</ code > .
72
85
</ li >
73
86
< li > Enter the token below:</ li >
74
87
</ ol >
75
88
89
+ { tokenHint }
90
+
76
91
< input
77
92
type = "text"
78
93
className = "input-text native-key-bindings"
0 commit comments