Merge pull request #1966 from thelounge/xpaw/no-session-convert
Remove session token hash conversion
This commit is contained in:
commit
0d068f34a8
@ -90,27 +90,6 @@ function Client(manager, name, config = {}) {
|
|||||||
|
|
||||||
if (typeof client.config.sessions !== "object") {
|
if (typeof client.config.sessions !== "object") {
|
||||||
client.config.sessions = {};
|
client.config.sessions = {};
|
||||||
} else {
|
|
||||||
// TODO: This is just for backwards compatibility. Remove in v3.0.0
|
|
||||||
const newSessions = {};
|
|
||||||
let changed = false;
|
|
||||||
|
|
||||||
_.forOwn(client.config.sessions, (session, key) => {
|
|
||||||
if (key.length !== 128) {
|
|
||||||
key = client.calculateTokenHash(key);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
newSessions[key] = session;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (changed) {
|
|
||||||
log.info(`User ${colors.bold(client.name)} has been updated with new security requirements for tokens.`);
|
|
||||||
|
|
||||||
delete client.config.token;
|
|
||||||
client.config.sessions = newSessions;
|
|
||||||
client.save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_.forOwn(client.config.sessions, (session) => {
|
_.forOwn(client.config.sessions, (session) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user