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 {
9696 return
9797 }
9898
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+
99104 // Use a temporary client to avoid messing with the global one while trying
100105 // to log in.
101106 const restClient = await makeCoderSdk ( url , undefined , this . storage )
102107
103108 let user : User | undefined
104- let token : string | undefined = args . length >= 2 ? args [ 1 ] : undefined
109+ let token : string | undefined = args [ 1 ]
105110 if ( ! token ) {
106111 const opened = await vscode . env . openExternal ( vscode . Uri . parse ( `${ url } /cli-auth` ) )
107112 if ( ! opened ) {
@@ -158,7 +163,7 @@ export class Commands {
158163 await this . storage . setSessionToken ( token )
159164
160165 // 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 )
162167
163168 await vscode . commands . executeCommand ( "setContext" , "coder.authenticated" , true )
164169 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 {
6767 await this . closeRemote ( )
6868 } else {
6969 // Log in then try again.
70- await vscode . commands . executeCommand ( "coder.login" , baseUrlRaw )
70+ await vscode . commands . executeCommand ( "coder.login" , baseUrlRaw , undefined , parts . label )
7171 await this . setup ( remoteAuthority )
7272 }
7373 return
@@ -149,7 +149,7 @@ export class Remote {
149149 if ( ! result ) {
150150 await this . closeRemote ( )
151151 } else {
152- await vscode . commands . executeCommand ( "coder.login" , baseUrlRaw )
152+ await vscode . commands . executeCommand ( "coder.login" , baseUrlRaw , undefined , parts . label )
153153 await this . setup ( remoteAuthority )
154154 }
155155 return
You can’t perform that action at this time.
0 commit comments