@@ -93,29 +93,33 @@ export async function upgradeSettings(
93
93
showWordPressEditConfirm : existingSettings . showWordPressEditConfirm ,
94
94
mathJaxOutputType : existingSettings . mathJaxOutputType
95
95
} ) ;
96
- const endpoint = existingSettings . endpoint ;
97
- const apiType = existingSettings . apiType ;
98
- const xmlRpcPath = existingSettings . xmlRpcPath ;
99
- const username = existingSettings . username ;
100
- const password = existingSettings . password ;
101
- const lastSelectedCategories = existingSettings . lastSelectedCategories ;
102
- const crypto = new PassCrypto ( ) ;
103
- const encryptedPassword = await crypto . encrypt ( password ) ;
104
- const profile = {
105
- name : WP_DEFAULT_PROFILE_NAME ,
106
- apiType : apiType ,
107
- endpoint : endpoint ,
108
- xmlRpcPath : xmlRpcPath ,
109
- saveUsername : ! isNil ( username ) ,
110
- savePassword : ! isNil ( password ) ,
111
- isDefault : true ,
112
- lastSelectedCategories : lastSelectedCategories ,
113
- username : username ,
114
- encryptedPassword : encryptedPassword
115
- } ;
116
- newSettings . profiles = [
117
- profile
118
- ] ;
96
+ if ( existingSettings . endpoint ) {
97
+ const endpoint = existingSettings . endpoint ;
98
+ const apiType = existingSettings . apiType ;
99
+ const xmlRpcPath = existingSettings . xmlRpcPath ;
100
+ const username = existingSettings . username ;
101
+ const password = existingSettings . password ;
102
+ const lastSelectedCategories = existingSettings . lastSelectedCategories ;
103
+ const crypto = new PassCrypto ( ) ;
104
+ const encryptedPassword = await crypto . encrypt ( password ) ;
105
+ const profile = {
106
+ name : WP_DEFAULT_PROFILE_NAME ,
107
+ apiType : apiType ,
108
+ endpoint : endpoint ,
109
+ xmlRpcPath : xmlRpcPath ,
110
+ saveUsername : ! isNil ( username ) ,
111
+ savePassword : ! isNil ( password ) ,
112
+ isDefault : true ,
113
+ lastSelectedCategories : lastSelectedCategories ,
114
+ username : username ,
115
+ encryptedPassword : encryptedPassword
116
+ } ;
117
+ newSettings . profiles = [
118
+ profile
119
+ ] ;
120
+ } else {
121
+ newSettings . profiles = [ ] ;
122
+ }
119
123
return newSettings ;
120
124
}
121
125
}
0 commit comments