|  | @@ -29,6 +29,7 @@ module.exports = Mn.View.extend({
 | 
											
												
													
														|  |          save:                     'button.save',
 |  |          save:                     'button.save',
 | 
											
												
													
														|  |          add_location_btn:         'button.add_location',
 |  |          add_location_btn:         'button.add_location',
 | 
											
												
													
														|  |          locations_container:      '.locations_container',
 |  |          locations_container:      '.locations_container',
 | 
											
												
													
														|  | 
 |  | +        le_error_info:            '#le-error-info',
 | 
											
												
													
														|  |          certificate_select:       'select[name="certificate_id"]',
 |  |          certificate_select:       'select[name="certificate_id"]',
 | 
											
												
													
														|  |          access_list_select:       'select[name="access_list_id"]',
 |  |          access_list_select:       'select[name="access_list_id"]',
 | 
											
												
													
														|  |          ssl_forced:               'input[name="ssl_forced"]',
 |  |          ssl_forced:               'input[name="ssl_forced"]',
 | 
											
										
											
												
													
														|  | @@ -137,6 +138,7 @@ module.exports = Mn.View.extend({
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          'click @ui.save': function (e) {
 |  |          'click @ui.save': function (e) {
 | 
											
												
													
														|  |              e.preventDefault();
 |  |              e.preventDefault();
 | 
											
												
													
														|  | 
 |  | +            this.ui.le_error_info.hide();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              if (!this.ui.form[0].checkValidity()) {
 |  |              if (!this.ui.form[0].checkValidity()) {
 | 
											
												
													
														|  |                  $('<input type="submit">').hide().appendTo(this.ui.form).click().remove();
 |  |                  $('<input type="submit">').hide().appendTo(this.ui.form).click().remove();
 | 
											
										
											
												
													
														|  | @@ -165,7 +167,18 @@ module.exports = Mn.View.extend({
 | 
											
												
													
														|  |              data.hsts_enabled            = !!data.hsts_enabled;
 |  |              data.hsts_enabled            = !!data.hsts_enabled;
 | 
											
												
													
														|  |              data.hsts_subdomains         = !!data.hsts_subdomains;
 |  |              data.hsts_subdomains         = !!data.hsts_subdomains;
 | 
											
												
													
														|  |              data.ssl_forced              = !!data.ssl_forced;
 |  |              data.ssl_forced              = !!data.ssl_forced;
 | 
											
												
													
														|  | -            data.meta.dns_challenge      = !!data.meta.dns_challenge;
 |  | 
 | 
											
												
													
														|  | 
 |  | +            
 | 
											
												
													
														|  | 
 |  | +            if (typeof data.meta === 'undefined') data.meta = {};
 | 
											
												
													
														|  | 
 |  | +            data.meta.letsencrypt_agree = data.meta.letsencrypt_agree == 1;
 | 
											
												
													
														|  | 
 |  | +            data.meta.dns_challenge = data.meta.dns_challenge == 1;
 | 
											
												
													
														|  | 
 |  | +            
 | 
											
												
													
														|  | 
 |  | +            if(!data.meta.dns_challenge){
 | 
											
												
													
														|  | 
 |  | +                data.meta.dns_provider = undefined;
 | 
											
												
													
														|  | 
 |  | +                data.meta.dns_provider_credentials = undefined;
 | 
											
												
													
														|  | 
 |  | +                data.meta.propagation_seconds = undefined;
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  | 
 |  | +                if(data.meta.propagation_seconds === '') data.meta.propagation_seconds = undefined; 
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              if (typeof data.domain_names === 'string' && data.domain_names) {
 |  |              if (typeof data.domain_names === 'string' && data.domain_names) {
 | 
											
												
													
														|  |                  data.domain_names = data.domain_names.split(',');
 |  |                  data.domain_names = data.domain_names.split(',');
 | 
											
										
											
												
													
														|  | @@ -186,8 +199,6 @@ module.exports = Mn.View.extend({
 | 
											
												
													
														|  |                      alert(i18n('ssl', 'no-wildcard-without-dns'));
 |  |                      alert(i18n('ssl', 'no-wildcard-without-dns'));
 | 
											
												
													
														|  |                      return;
 |  |                      return;
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -                data.meta.letsencrypt_agree = data.meta.letsencrypt_agree === '1';                
 |  | 
 | 
											
												
													
														|  |              } else {
 |  |              } else {
 | 
											
												
													
														|  |                  data.certificate_id = parseInt(data.certificate_id, 10);
 |  |                  data.certificate_id = parseInt(data.certificate_id, 10);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
										
											
												
													
														|  | @@ -216,7 +227,15 @@ module.exports = Mn.View.extend({
 | 
											
												
													
														|  |                      });
 |  |                      });
 | 
											
												
													
														|  |                  })
 |  |                  })
 | 
											
												
													
														|  |                  .catch(err => {
 |  |                  .catch(err => {
 | 
											
												
													
														|  | -                    alert(err.message);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    let more_info = '';
 | 
											
												
													
														|  | 
 |  | +                    if(err.code === 500){
 | 
											
												
													
														|  | 
 |  | +                        try{
 | 
											
												
													
														|  | 
 |  | +                            more_info = JSON.parse(err.debug).debug.stack.join("\n");
 | 
											
												
													
														|  | 
 |  | +                        } catch(e) {}
 | 
											
												
													
														|  | 
 |  | +                    }
 | 
											
												
													
														|  | 
 |  | +                    this.ui.le_error_info[0].innerHTML = `${err.message}${more_info !== '' ? `<pre class="mt-3">${more_info}</pre>`:''}`;
 | 
											
												
													
														|  | 
 |  | +                    this.ui.le_error_info.show();
 | 
											
												
													
														|  | 
 |  | +                    this.ui.le_error_info[0].scrollIntoView();
 | 
											
												
													
														|  |                      this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
 |  |                      this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
 | 
											
												
													
														|  |                      this.ui.save.removeClass('btn-loading');
 |  |                      this.ui.save.removeClass('btn-loading');
 | 
											
												
													
														|  |                  });
 |  |                  });
 | 
											
										
											
												
													
														|  | @@ -293,6 +312,7 @@ module.exports = Mn.View.extend({
 | 
											
												
													
														|  |          });
 |  |          });
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          // Certificates
 |  |          // Certificates
 | 
											
												
													
														|  | 
 |  | +        this.ui.le_error_info.hide();
 | 
											
												
													
														|  |          this.ui.dns_challenge_content.hide();
 |  |          this.ui.dns_challenge_content.hide();
 | 
											
												
													
														|  |          this.ui.credentials_file_content.hide();
 |  |          this.ui.credentials_file_content.hide();
 | 
											
												
													
														|  |          this.ui.letsencrypt.hide();
 |  |          this.ui.letsencrypt.hide();
 |