Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Suppress login failure dialog on autologin#409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletionssrc/commands.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,6 +143,7 @@ export class Commands {
const inputUrl = args[0]
const inputToken = args[1]
const inputLabel = args[2]
const isAutologin = typeof args[3] === "undefined" ? false : Boolean(args[3])

const url = await this.maybeAskUrl(inputUrl)
if (!url) {
Expand All@@ -155,7 +156,7 @@ export class Commands {
const label = typeof inputLabel === "undefined" ? toSafeHost(url) : inputLabel

// Try to get a token from the user, if we need one, and their user.
const res = await this.maybeAskToken(url, inputToken)
const res = await this.maybeAskToken(url, inputToken, isAutologin)
if (!res) {
return // The user aborted, or unable to auth.
}
Expand DownExpand Up@@ -202,7 +203,11 @@ export class Commands {
* token. Null means the user aborted or we were unable to authenticate with
* mTLS (in the latter case, an error notification will have been displayed).
*/
private async maybeAskToken(url: string, token: string): Promise<{ user: User; token: string } | null> {
private async maybeAskToken(
url: string,
token: string,
isAutologin: boolean,
): Promise<{ user: User; token: string } | null> {
const restClient = await makeCoderSdk(url, token, this.storage)
if (!needToken()) {
try {
Expand All@@ -212,11 +217,15 @@ export class Commands {
return { token: "", user }
} catch (err) {
const message = getErrorMessage(err, "no response from the server")
this.vscodeProposed.window.showErrorMessage("Failed to log in", {
detail: message,
modal: true,
useCustom: true,
})
if (isAutologin) {
this.storage.writeToCoderOutputChannel(`Failed to log in to Coder server: ${message}`)
} else {
this.vscodeProposed.window.showErrorMessage("Failed to log in to Coder server", {
detail: message,
modal: true,
useCustom: true,
})
}
// Invalid certificate, most likely.
return null
}
Expand Down
2 changes: 1 addition & 1 deletionsrc/extension.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -221,7 +221,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
if (cfg.get("coder.autologin") === true) {
const defaultUrl = cfg.get("coder.defaultUrl") || process.env.CODER_URL
if (defaultUrl) {
vscode.commands.executeCommand("coder.login", defaultUrl)
vscode.commands.executeCommand("coder.login", defaultUrl, undefined, undefined, "true")
}
}
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp