@@ -43,7 +43,9 @@ module.exports = Mn.View.extend({
43
43
dns_provider_credentials : 'textarea[name="meta[dns_provider_credentials]"]' ,
44
44
propagation_seconds : 'input[name="meta[propagation_seconds]"]' ,
45
45
forward_scheme : 'select[name="forward_scheme"]' ,
46
- letsencrypt : '.letsencrypt'
46
+ letsencrypt : '.letsencrypt' ,
47
+ openidc_enabled : 'input[name="openidc_enabled"]' ,
48
+ openidc : '.openidc'
47
49
} ,
48
50
49
51
regions : {
@@ -113,7 +115,7 @@ module.exports = Mn.View.extend({
113
115
} else {
114
116
this . ui . dns_provider . prop ( 'required' , false ) ;
115
117
this . ui . dns_provider_credentials . prop ( 'required' , false ) ;
116
- this . ui . dns_challenge_content . hide ( ) ;
118
+ this . ui . dns_challenge_content . hide ( ) ;
117
119
}
118
120
} ,
119
121
@@ -125,13 +127,24 @@ module.exports = Mn.View.extend({
125
127
this . ui . credentials_file_content . show ( ) ;
126
128
} else {
127
129
this . ui . dns_provider_credentials . prop ( 'required' , false ) ;
128
- this . ui . credentials_file_content . hide ( ) ;
130
+ this . ui . credentials_file_content . hide ( ) ;
131
+ }
132
+ } ,
133
+
134
+ 'change @ui.openidc_enabled' : function ( ) {
135
+ console . log ( 'Changing' ) ;
136
+ let checked = this . ui . openidc_enabled . prop ( 'checked' ) ;
137
+
138
+ if ( checked ) {
139
+ this . ui . openidc . show ( ) . find ( 'input' ) . prop ( 'required' , true ) ;
140
+ } else {
141
+ this . ui . openidc . hide ( ) . find ( 'input' ) . prop ( 'required' , false ) ;
129
142
}
130
143
} ,
131
144
132
145
'click @ui.add_location_btn' : function ( e ) {
133
146
e . preventDefault ( ) ;
134
-
147
+
135
148
const model = new ProxyLocationModel . Model ( ) ;
136
149
this . locationsCollection . add ( model ) ;
137
150
} ,
@@ -167,25 +180,26 @@ module.exports = Mn.View.extend({
167
180
data . hsts_enabled = ! ! data . hsts_enabled ;
168
181
data . hsts_subdomains = ! ! data . hsts_subdomains ;
169
182
data . ssl_forced = ! ! data . ssl_forced ;
170
-
183
+ data . openidc_enabled = data . openidc_enabled === '1' ;
184
+
171
185
if ( typeof data . meta === 'undefined' ) data . meta = { } ;
172
186
data . meta . letsencrypt_agree = data . meta . letsencrypt_agree == 1 ;
173
187
data . meta . dns_challenge = data . meta . dns_challenge == 1 ;
174
-
188
+
175
189
if ( ! data . meta . dns_challenge ) {
176
190
data . meta . dns_provider = undefined ;
177
191
data . meta . dns_provider_credentials = undefined ;
178
192
data . meta . propagation_seconds = undefined ;
179
193
} else {
180
- if ( data . meta . propagation_seconds === '' ) data . meta . propagation_seconds = undefined ;
194
+ if ( data . meta . propagation_seconds === '' ) data . meta . propagation_seconds = undefined ;
181
195
}
182
196
183
197
if ( typeof data . domain_names === 'string' && data . domain_names ) {
184
198
data . domain_names = data . domain_names . split ( ',' ) ;
185
199
}
186
200
187
201
// Check for any ___domain names containing wildcards, which are not allowed with letsencrypt
188
- if ( data . certificate_id === 'new' ) {
202
+ if ( data . certificate_id === 'new' ) {
189
203
let domain_err = false ;
190
204
if ( ! data . meta . dns_challenge ) {
191
205
data . domain_names . map ( function ( name ) {
@@ -203,6 +217,12 @@ module.exports = Mn.View.extend({
203
217
data . certificate_id = parseInt ( data . certificate_id , 10 ) ;
204
218
}
205
219
220
+ // OpenID Connect won't work with multiple ___domain names because the redirect URL has to point to a specific one
221
+ if ( data . openidc_enabled && data . domain_names . length > 1 ) {
222
+ alert ( 'Cannot use mutliple ___domain names when OpenID Connect is enabled' ) ;
223
+ return ;
224
+ }
225
+
206
226
let method = App . Api . Nginx . ProxyHosts . create ;
207
227
let is_new = true ;
208
228
@@ -344,6 +364,9 @@ module.exports = Mn.View.extend({
344
364
view . ui . certificate_select [ 0 ] . selectize . setValue ( view . model . get ( 'certificate_id' ) ) ;
345
365
}
346
366
} ) ;
367
+
368
+ // OpenID Connect
369
+ this . ui . openidc . hide ( ) . find ( 'input' ) . prop ( 'required' , false ) ;
347
370
} ,
348
371
349
372
initialize : function ( options ) {
0 commit comments