@@ -28,17 +28,29 @@ angular.module("openshiftConsole")
28
28
return secretsByType ;
29
29
} ;
30
30
31
+ var setDataParams = function ( decodedSecretData , serverName , data ) {
32
+ var usernamePassword = [ ] ;
33
+ if ( data . auth ) {
34
+ usernamePassword = window . atob ( data . auth ) . split ( ":" ) ;
35
+ } else if ( data . username && data . password ) {
36
+ usernamePassword = [ data . username , data . password ] ;
37
+ }
38
+
39
+ decodedSecretData . auths [ serverName ] = {
40
+ username : usernamePassword [ 0 ] ,
41
+ password : usernamePassword [ 1 ] ,
42
+ email : data . email
43
+ } ;
44
+ return decodedSecretData ;
45
+ } ;
46
+
31
47
var decodeDockercfg = function ( encodedData ) {
32
48
var decodedSecretData = {
33
49
auths : { }
34
50
} ;
35
51
var decodedData = JSON . parse ( window . atob ( encodedData ) ) ;
36
52
_ . each ( decodedData , function ( data , serverName ) {
37
- decodedSecretData . auths [ serverName ] = {
38
- username : data . username ,
39
- password : data . password ,
40
- email : data . email
41
- } ;
53
+ decodedSecretData = setDataParams ( decodedSecretData , serverName , data ) ;
42
54
} ) ;
43
55
return decodedSecretData ;
44
56
} ;
@@ -53,13 +65,7 @@ angular.module("openshiftConsole")
53
65
decodedSecretData . auths [ serverName ] = data ;
54
66
return ;
55
67
}
56
-
57
- var usernamePassword = window . atob ( data . auth ) . split ( ":" ) ;
58
- decodedSecretData . auths [ serverName ] = {
59
- username : usernamePassword [ 0 ] ,
60
- password : usernamePassword [ 1 ] ,
61
- email : data . email
62
- } ;
68
+ decodedSecretData = setDataParams ( decodedSecretData , serverName , data ) ;
63
69
} ) ;
64
70
65
71
if ( decodedData . credsStore ) {
0 commit comments