Browse Source

Add Certificate Validation option to Wizard

Otherwise a user would be stuck.
pull/832/head
Safihre 8 years ago
parent
commit
89f91e46b7
  1. 12
      interfaces/wizard/one.html
  2. 2
      interfaces/wizard/static/javascript/checkserver.js
  3. 13
      interfaces/wizard/static/style.css
  4. 4
      sabnzbd/wizard.py

12
interfaces/wizard/one.html

@ -64,13 +64,23 @@
<input type="number" class="form-control" name="connections" id="connections" value="<!--#if $connections then $connections else '8'#-->" data-toggle="tooltip" data-placement="right" title="$T('wizard-server-con-explain') $T('wizard-server-con-eg')" />
</div>
</div>
<div class="form-group">
<label for="ssl_verify" class="col-sm-4 control-label">$T('opt-ssl_verify')</label>
<div class="col-sm-8">
<select name="ssl_verify" id="ssl_verify" class="form-control" <!--#if int($have_ssl_context) == 0 then "disabled=\"disabled\"" else ""#-->>
<option value="0" <!--#if $ssl_verify == 0 then 'selected="selected"' else ""#--> >$T('ssl_verify-disabled')</option>
<option value="1" <!--#if $ssl_verify == 1 then 'selected="selected"' else ""#--> >$T('ssl_verify-normal')</option>
<option value="2" <!--#if $ssl_verify == 2 then 'selected="selected"' else ""#--> >$T('ssl_verify-strict')</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<button id="serverTest" class="btn btn-default"><span class="glyphicon glyphicon-sort"></span> $T('wizard-button-testServer')</button>
</div>
<div class="col-sm-8">
<div id="serverQuote" class="btn btn-default disabled"><span id="serverResponse">$T('wizard-server-text')</span></div>
<div id="serverResponse" class="well well-sm">$T('wizard-server-text')</div>
</div>
</div>

2
interfaces/wizard/static/javascript/checkserver.js

@ -24,7 +24,7 @@ $(document).ready(function() {
} else {
r = '<span class="failed"><span class="glyphicon glyphicon-minus-sign"></span> ' + result.value.message + '</span>';
}
r = r.replace('https://sabnzbd.org/certificate-errors', '<a href="https://sabnzbd.org/certificate-errors" class="failed" target="_blank">https://sabnzbd.org/certificate-errors</a>')
$('#serverResponse').html(r);
}
);

13
interfaces/wizard/static/style.css

@ -62,7 +62,7 @@ a[target="_blank"] {
color: #00cc22;
}
.failed {
color: red;
color: red !important;
}
#rightGreyText {
color: #ccc;
@ -164,16 +164,12 @@ label {
text-decoration: line-through;
color: #ccc;
}
#serverQuote {
opacity: 0.8;
box-shadow: none !important;
white-space: normal;
width: 100%;
#serverResponse {
padding: 6px 10px;
}
#host-tip {
margin-bottom: 5px;
}
.error-text {
display: inline;
color: red;
@ -192,7 +188,8 @@ label {
#content a,
#content a:hover,
#content a:active,
#content a:visited {
#content a:visited,
#serverResponse {
color: #555;
}
.btn {

4
sabnzbd/wizard.py

@ -95,6 +95,7 @@ class Wizard(object):
info['language'] = cfg.language()
info['active_lang'] = info['language']
info['T'] = Ttemplate
info['have_ssl_context'] = sabnzbd.HAVE_SSL_CONTEXT
servers = config.get_servers()
if not servers:
@ -104,6 +105,7 @@ class Wizard(object):
info['password'] = ''
info['connections'] = ''
info['ssl'] = 0
info['ssl_verify'] = 2
else:
for server in servers:
# If there are multiple servers, just use the first enabled one
@ -113,8 +115,8 @@ class Wizard(object):
info['username'] = s.username()
info['password'] = s.password.get_stars()
info['connections'] = s.connections()
info['ssl'] = s.ssl()
info['ssl_verify'] = s.ssl_verify()
if s.enable():
break
template = Template(file=os.path.join(self.__web_dir, 'one.html'),

Loading…
Cancel
Save