Don't save default username/realname in local storage

This commit is contained in:
Simon Ser 2021-05-31 17:57:17 +02:00
parent bc7162ebe2
commit c632ef4339
2 changed files with 14 additions and 3 deletions

View file

@ -50,6 +50,17 @@ function parseQueryString() {
return params; 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. */ /* Insert a message in an immutable list of sorted messages. */
function insertMessage(list, msg) { function insertMessage(list, msg) {
if (list.length == 0) { if (list.length == 0) {
@ -525,7 +536,7 @@ export default class App extends Component {
}); });
this.setState({ connectParams: params }); this.setState({ connectParams: params });
var client = new Client(params); var client = new Client(fillConnectParams(params));
this.clients.set(netID, client); this.clients.set(netID, client);
client.addEventListener("status", () => { client.addEventListener("status", () => {

View file

@ -49,8 +49,8 @@ export default class ConnectForm extends Component {
pass: this.state.serverPass, pass: this.state.serverPass,
nick: this.state.nick, nick: this.state.nick,
autoconnect: this.state.rememberMe, autoconnect: this.state.rememberMe,
username: this.state.username || this.state.nick, username: this.state.username,
realname: this.state.realname || this.state.nick, realname: this.state.realname,
saslPlain: null, saslPlain: null,
autojoin: [], autojoin: [],
}; };