From c632ef4339a81d646bb916eeb6e2176297f1e6d8 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 31 May 2021 17:57:17 +0200 Subject: [PATCH] Don't save default username/realname in local storage --- components/app.js | 13 ++++++++++++- components/connect-form.js | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components/app.js b/components/app.js index 463ca58..f79ec28 100644 --- a/components/app.js +++ b/components/app.js @@ -50,6 +50,17 @@ function parseQueryString() { return params; } +function fillConnectParams(params) { + params = { ...params }; + if (!params.username) { + params.username = params.nick; + } + if (!params.realname) { + params.realname = params.nick; + } + return params; +} + /* Insert a message in an immutable list of sorted messages. */ function insertMessage(list, msg) { if (list.length == 0) { @@ -525,7 +536,7 @@ export default class App extends Component { }); this.setState({ connectParams: params }); - var client = new Client(params); + var client = new Client(fillConnectParams(params)); this.clients.set(netID, client); client.addEventListener("status", () => { diff --git a/components/connect-form.js b/components/connect-form.js index 9104896..d79c5f2 100644 --- a/components/connect-form.js +++ b/components/connect-form.js @@ -49,8 +49,8 @@ export default class ConnectForm extends Component { pass: this.state.serverPass, nick: this.state.nick, autoconnect: this.state.rememberMe, - username: this.state.username || this.state.nick, - realname: this.state.realname || this.state.nick, + username: this.state.username, + realname: this.state.realname, saslPlain: null, autojoin: [], };