File tree 2 files changed +22
-14
lines changed
client/src/components/apps
2 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -2137,7 +2137,7 @@ export default defineComponent({
2137
2137
this .buildstrategy = response .data .spec .buildstrategy || ' plain' ;
2138
2138
this .appname = response .data .spec .name ;
2139
2139
this .sleep = response .data .spec .sleep ;
2140
- this .basicAuth = response .data .spec .basicAuth || { realm: ' Authentication required' , accounts: [] };
2140
+ this .basicAuth = response .data .spec .basicAuth || { enabled: false , realm: ' Authentication required' , accounts: [] };
2141
2141
this .buildpack = {
2142
2142
run: response .data .spec .image .run ,
2143
2143
build: response .data .spec .image .build ,
Original file line number Diff line number Diff line change @@ -174,19 +174,27 @@ export class App implements IApp{
174
174
this . autoscale = app . autoscale // TODO: may be redundant with autoscaling.enabled
175
175
176
176
const salt = genSaltSync ( 10 ) ;
177
- this . basicAuth = {
178
- realm : app . basicAuth . realm ,
179
- enabled : app . basicAuth . enabled ,
180
- accounts : app . basicAuth . accounts . map ( account => {
181
- return {
182
- user : account . user ,
183
- pass : account . pass ,
184
- // generate hash with bcrypt from user and pass
185
- //hash: account.user+':$5$'+crypto.createHash('sha256').update(account.user+account.pass).digest('base64')
186
- //hash: account.user+':{SHA}'+crypto.createHash('sha1').update(account.pass).digest('base64') // works
187
- hash : account . user + ':' + hashSync ( account . pass , salt )
188
- }
189
- } )
177
+ if ( app . basicAuth !== undefined ) {
178
+ this . basicAuth = {
179
+ realm : app . basicAuth . realm ,
180
+ enabled : app . basicAuth . enabled ,
181
+ accounts : app . basicAuth . accounts . map ( account => {
182
+ return {
183
+ user : account . user ,
184
+ pass : account . pass ,
185
+ // generate hash with bcrypt from user and pass
186
+ //hash: account.user+':$5$'+crypto.createHash('sha256').update(account.user+account.pass).digest('base64')
187
+ //hash: account.user+':{SHA}'+crypto.createHash('sha1').update(account.pass).digest('base64') // works
188
+ hash : account . user + ':' + hashSync ( account . pass , salt )
189
+ }
190
+ } )
191
+ }
192
+ } else {
193
+ this . basicAuth = {
194
+ realm : 'Authenticate' ,
195
+ enabled : false ,
196
+ accounts : [ ]
197
+ }
190
198
}
191
199
192
200
this . envVars = app . envVars
You can’t perform that action at this time.
0 commit comments