2018-06-04 00:06:17 +08:00
|
|
|
(function (global, document) {
|
2018-06-24 10:01:21 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
(document);
|
2018-06-04 00:06:17 +08:00
|
|
|
|
|
|
|
// Opens the general settings window.
|
|
|
|
global.generalOpen = function() {
|
|
|
|
$(".view").hide();
|
|
|
|
$("#general-view").show();
|
|
|
|
};
|
|
|
|
|
|
|
|
global.generalSaveHandler = function() {
|
|
|
|
var data = global.dashboard.$data;
|
|
|
|
|
|
|
|
global.buttonDisable("#save-general-button");
|
|
|
|
global.domainUpdate(data.domains[data.cd], function() {
|
|
|
|
global.globalOKShow("Settings saved!");
|
|
|
|
global.buttonEnable("#save-general-button");
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2019-04-21 08:34:25 +08:00
|
|
|
global.ssoProviderChangeHandler = function() {
|
|
|
|
var data = global.dashboard.$data;
|
|
|
|
|
|
|
|
if (data.domains[data.cd].ssoSecret === "") {
|
|
|
|
var json = {
|
|
|
|
"ownerToken": global.cookieGet("commentoOwnerToken"),
|
|
|
|
"domain": data.domains[data.cd].domain,
|
|
|
|
};
|
|
|
|
|
|
|
|
global.post(global.origin + "/api/domain/sso/new", json, function(resp) {
|
|
|
|
if (!resp.success) {
|
|
|
|
global.globalErrorShow(resp.message);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
data.domains[data.cd].ssoSecret = resp.ssoSecret;
|
|
|
|
$("#sso-secret").val(data.domains[data.cd].ssoSecret);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$("#sso-secret").val(data.domains[data.cd].ssoSecret);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-12-20 13:48:43 +08:00
|
|
|
} (window.commento, document));
|