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

View File

@ -45,6 +45,7 @@
<span id="connect:portseparator">:</span>
<input
id="connect:port"
ref="serverPort"
class="input"
type="number"
min="1"
@ -65,6 +66,7 @@
name="tls"
:checked="defaults.tls ? true : false"
:disabled="config.lockNetwork ? true : false"
@change="onSecureChanged"
/>
Use secure connection (TLS)
</label>
@ -194,6 +196,16 @@ export default {
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) {
const formData = new FormData(event.target);
const data = {};