Add success: false to change-password error emits.

This commit is contained in:
Richard Lewis 2019-03-03 17:27:57 +02:00 committed by Pavel Djundik
parent 6c10a2a6cf
commit 2ef3e3e5b4

View File

@ -426,6 +426,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
if (typeof p1 === "undefined" || p1 === "" || p1 !== p2) { if (typeof p1 === "undefined" || p1 === "" || p1 !== p2) {
socket.emit("change-password", { socket.emit("change-password", {
error: "", error: "",
success: false,
}); });
return; return;
} }
@ -436,6 +437,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
if (!matching) { if (!matching) {
socket.emit("change-password", { socket.emit("change-password", {
error: "password_incorrect", error: "password_incorrect",
success: false,
}); });
return; return;
} }
@ -443,7 +445,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
const hash = Helper.password.hash(p1); const hash = Helper.password.hash(p1);
client.setPassword(hash, (success) => { client.setPassword(hash, (success) => {
const obj = {}; const obj = {success: false};
if (success) { if (success) {
obj.success = true; obj.success = true;