File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,16 @@ export class Login {
65
65
}
66
66
}
67
67
let auth
68
+ const logout = async ( ) => {
69
+ if ( previousEntry && previousEntry . password ) {
70
+ try {
71
+ await this . logout ( previousEntry . password )
72
+ delete previousEntry . password
73
+ } catch ( err ) {
74
+ ux . warn ( err )
75
+ }
76
+ }
77
+ }
68
78
switch ( input ) {
69
79
case 'b' :
70
80
case 'browser' :
@@ -76,19 +86,14 @@ export class Login {
76
86
break
77
87
case 's' :
78
88
case 'sso' :
89
+ await logout ( ) // for sso logout first
79
90
auth = await this . sso ( previousEntry && previousEntry . org )
80
91
break
81
92
default :
82
93
return this . login ( opts )
83
94
}
84
95
await this . saveToken ( auth )
85
- if ( previousEntry ) {
86
- try {
87
- await this . logout ( previousEntry . password )
88
- } catch ( err ) {
89
- ux . warn ( err )
90
- }
91
- }
96
+ await logout ( )
92
97
} catch ( err ) {
93
98
throw new HerokuAPIError ( err )
94
99
} finally {
You can’t perform that action at this time.
0 commit comments