Make settings/options mostly work

Fixes #1672
This commit is contained in:
Pavel Djundik 2017-11-04 19:32:18 +02:00
parent 55d1625ab2
commit 711b5e1d91
5 changed files with 34 additions and 2 deletions

View File

@ -15,7 +15,6 @@ const templates = require("../views");
const socket = require("./socket");
require("./socket-events");
const storage = require("./localStorage");
require("./options");
const utils = require("./utils");
require("./autocompletion");
require("./webpush");

View File

@ -0,0 +1,14 @@
"use strict";
const $ = require("jquery");
const socket = require("../socket");
const storage = require("../localStorage");
const utils = require("../utils");
const templates = require("../../views");
socket.on("configuration", function(data) {
$("#settings").html(templates.windows.settings(data));
$("#connect").html(templates.windows.connect(data));
require("../options");
});

View File

@ -18,3 +18,4 @@ require("./topic");
require("./users");
require("./sign_out");
require("./sessions_list");
require("./configuration");

View File

@ -145,7 +145,7 @@
</div>
{{#unless public}}
{{#unless ldap.enable}}
{{#unless ldapEnabled}}
<div id="change-password">
<form action="" method="post">
<div class="col-sm-12">

View File

@ -467,6 +467,22 @@ function initializeClient(socket, client, token, lastMessage) {
}
}
function getClientConfiguration() {
const config = _.pick(Helper.config, [
"public",
"lockNetwork",
"displayNetwork",
"useHexIp",
"defaults",
"themes",
"prefetch",
]);
config.ldapEnabled = Helper.config.ldap.enable;
return config;
}
function performAuthentication(data) {
const socket = this;
let client;
@ -474,6 +490,8 @@ function performAuthentication(data) {
const finalInit = () => initializeClient(socket, client, data.token || null, data.lastMessage || -1);
const initClient = () => {
socket.emit("configuration", getClientConfiguration());
client.ip = getClientIp(socket);
// If webirc is enabled perform reverse dns lookup