File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,17 @@ export class Commands {
96
96
return
97
97
}
98
98
99
+ // It is possible that we are trying to log into an old-style host, in which
100
+ // case we want to write with the provided blank label instead of generating
101
+ // a host label.
102
+ const label = typeof args [ 2 ] === "undefined" ? toSafeHost ( url ) : args [ 2 ]
103
+
99
104
// Use a temporary client to avoid messing with the global one while trying
100
105
// to log in.
101
106
const restClient = await makeCoderSdk ( url , undefined , this . storage )
102
107
103
108
let user : User | undefined
104
- let token : string | undefined = args . length >= 2 ? args [ 1 ] : undefined
109
+ let token : string | undefined = args [ 1 ]
105
110
if ( ! token ) {
106
111
const opened = await vscode . env . openExternal ( vscode . Uri . parse ( `${ url } /cli-auth` ) )
107
112
if ( ! opened ) {
@@ -158,7 +163,7 @@ export class Commands {
158
163
await this . storage . setSessionToken ( token )
159
164
160
165
// Store on disk to be used by the cli.
161
- await this . storage . configureCli ( toSafeHost ( url ) , url , token )
166
+ await this . storage . configureCli ( label , url , token )
162
167
163
168
await vscode . commands . executeCommand ( "setContext" , "coder.authenticated" , true )
164
169
if ( user . roles . find ( ( role ) => role . name === "owner" ) ) {
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ export class Remote {
67
67
await this . closeRemote ( )
68
68
} else {
69
69
// Log in then try again.
70
- await vscode . commands . executeCommand ( "coder.login" , baseUrlRaw )
70
+ await vscode . commands . executeCommand ( "coder.login" , baseUrlRaw , undefined , parts . label )
71
71
await this . setup ( remoteAuthority )
72
72
}
73
73
return
@@ -149,7 +149,7 @@ export class Remote {
149
149
if ( ! result ) {
150
150
await this . closeRemote ( )
151
151
} else {
152
- await vscode . commands . executeCommand ( "coder.login" , baseUrlRaw )
152
+ await vscode . commands . executeCommand ( "coder.login" , baseUrlRaw , undefined , parts . label )
153
153
await this . setup ( remoteAuthority )
154
154
}
155
155
return
You can’t perform that action at this time.
0 commit comments