Don't ask for username when provided in URL

This commit is contained in:
Markus Olsson 2024-05-16 16:50:54 +02:00
parent eb85e8555c
commit 08ed51edd8
4 changed files with 11 additions and 4 deletions

View file

@ -66,6 +66,7 @@ class TrampolineUIHelper {
this.dispatcher.showPopup({
type: PopupType.GenericGitAuthentication,
remoteUrl,
username,
onSubmit: (username: string, password: string) =>
resolve({ username, password }),
onDismiss: () => resolve({ username: '', password: '' }),

View file

@ -171,7 +171,8 @@ export type PopupDetail =
| { type: PopupType.CLIInstalled }
| {
type: PopupType.GenericGitAuthentication
hostname: string
remoteUrl: string
username?: string
onSubmit: (username: string, password: string) => void
onDismiss: () => void
}

View file

@ -1926,6 +1926,7 @@ export class App extends React.Component<IAppProps, IAppState> {
<GenericGitAuthentication
key="generic-git-authentication"
remoteUrl={popup.remoteUrl}
username={popup.username}
// eslint-disable-next-line react/jsx-no-bind
onDismiss={onDismiss}
onSave={popup.onSubmit}

View file

@ -54,9 +54,13 @@ export class GenericGitAuthentication extends React.Component<
<p>
We were unable to authenticate with{' '}
<Ref>{this.props.remoteUrl}</Ref>. Please enter{' '}
{this.props.username
? `the password for the user ${this.props.username}`
: 'your username and password'}{' '}
{this.props.username ? (
<>
the password for the user <Ref>{this.props.username}</Ref>
</>
) : (
'your username and password'
)}{' '}
to try again.
</p>