mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-04 23:02:18 +02:00
server: remove type cast from change pw
This commit is contained in:
parent
e61e356f1e
commit
82e4150cc8
|
@ -546,18 +546,10 @@ function initializeClient(
|
||||||
const hash = Helper.password.hash(p1);
|
const hash = Helper.password.hash(p1);
|
||||||
|
|
||||||
client.setPassword(hash, (success: boolean) => {
|
client.setPassword(hash, (success: boolean) => {
|
||||||
const obj = {success: false, error: undefined} as {
|
socket.emit("change-password", {
|
||||||
success: boolean;
|
success: success,
|
||||||
error: string | undefined;
|
error: success ? undefined : "update_failed",
|
||||||
};
|
});
|
||||||
|
|
||||||
if (success) {
|
|
||||||
obj.success = true;
|
|
||||||
} else {
|
|
||||||
obj.error = "update_failed";
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.emit("change-password", obj);
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error: Error) => {
|
.catch((error: Error) => {
|
||||||
|
|
Loading…
Reference in a new issue