Switch default ports when toggling TLS

This commit is contained in:
Pavel Djundik 2019-12-28 23:08:46 +02:00
parent 56cc6d0b68
commit c055a07f45
1 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,7 @@
<span id="connect:portseparator">:</span> <span id="connect:portseparator">:</span>
<input <input
id="connect:port" id="connect:port"
ref="serverPort"
class="input" class="input"
type="number" type="number"
min="1" min="1"
@ -65,6 +66,7 @@
name="tls" name="tls"
:checked="defaults.tls ? true : false" :checked="defaults.tls ? true : false"
:disabled="config.lockNetwork ? true : false" :disabled="config.lockNetwork ? true : false"
@change="onSecureChanged"
/> />
Use secure connection (TLS) Use secure connection (TLS)
</label> </label>
@ -194,6 +196,16 @@ export default {
this.previousUsername = event.target.value; this.previousUsername = event.target.value;
}, },
onSecureChanged(event) {
const ports = ["6667", "6697"];
const newPort = event.target.checked ? 0 : 1;
// If you disable TLS and current port is 6697,
// set it to 6667, and vice versa
if (this.$refs.serverPort.value === ports[newPort]) {
this.$refs.serverPort.value = ports[1 - newPort];
}
},
onSubmit(event) { onSubmit(event) {
const formData = new FormData(event.target); const formData = new FormData(event.target);
const data = {}; const data = {};