Ability to disable profile
This commit is contained in:
parent
a34e227d37
commit
69c33e2f83
@ -88,14 +88,14 @@ define(function() {
|
|||||||
//config.hideUsageBar = true;
|
//config.hideUsageBar = true;
|
||||||
|
|
||||||
// Disable feedback for all the users and hide the settings part about feedback
|
// Disable feedback for all the users and hide the settings part about feedback
|
||||||
config.disableFeedback = true;
|
//config.disableFeedback = true;
|
||||||
|
|
||||||
// Add new options in the share modal (extend an existing tab or add a new tab).
|
// Add new options in the share modal (extend an existing tab or add a new tab).
|
||||||
// More info about how to use it on the wiki:
|
// More info about how to use it on the wiki:
|
||||||
// https://github.com/xwiki-labs/cryptpad/wiki/Application-config#configcustomizeshareoptions
|
// https://github.com/xwiki-labs/cryptpad/wiki/Application-config#configcustomizeshareoptions
|
||||||
//config.customizeShareOptions = function (hashes, tabs, config) {};
|
//config.customizeShareOptions = function (hashes, tabs, config) {};
|
||||||
|
|
||||||
// Add code to be executed on every page before loading the user object. `isLoggedIn` is a boolean
|
// Add code to be executed on every page before loading the user object. `isLoggedIn` (bool) is
|
||||||
// indicating if the user is registered or anonymous. Here you can change the way anonymous users
|
// indicating if the user is registered or anonymous. Here you can change the way anonymous users
|
||||||
// work in CryptPad, use an external SSO or even force registration
|
// work in CryptPad, use an external SSO or even force registration
|
||||||
// *NOTE*: You have to call the `callback` function to continue the loading process
|
// *NOTE*: You have to call the `callback` function to continue the loading process
|
||||||
@ -106,5 +106,10 @@ define(function() {
|
|||||||
// *NOTE*: You have to call the `callback` function to continue the loading process
|
// *NOTE*: You have to call the `callback` function to continue the loading process
|
||||||
//config.afterLogin = function(api, callback) {};
|
//config.afterLogin = function(api, callback) {};
|
||||||
|
|
||||||
|
// Disabling the profile app allows you to import the profile informations (display name, avatar)
|
||||||
|
// from an external source and make sure the users can't change them from CryptPad.
|
||||||
|
// You can use config.afterLogin to import these values in the users' drive.
|
||||||
|
//config.disableProfile = true;
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1274,7 +1274,7 @@ define([
|
|||||||
$userAdminContent.append($userAccount).append(Util.fixHTML(accountName));
|
$userAdminContent.append($userAccount).append(Util.fixHTML(accountName));
|
||||||
$userAdminContent.append($('<br>'));
|
$userAdminContent.append($('<br>'));
|
||||||
}
|
}
|
||||||
if (config.displayName) {
|
if (config.displayName && !AppConfig.disableProfile) {
|
||||||
// Hide "Display name:" in read only mode
|
// Hide "Display name:" in read only mode
|
||||||
$userName.append(Messages.user_displayName + ': ');
|
$userName.append(Messages.user_displayName + ': ');
|
||||||
$userName.append($displayedName);
|
$userName.append($displayedName);
|
||||||
@ -1297,14 +1297,14 @@ define([
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Add the change display name button if not in read only mode
|
// Add the change display name button if not in read only mode
|
||||||
if (config.changeNameButtonCls && config.displayChangeName) {
|
if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) {
|
||||||
options.push({
|
options.push({
|
||||||
tag: 'a',
|
tag: 'a',
|
||||||
attributes: {'class': config.changeNameButtonCls},
|
attributes: {'class': config.changeNameButtonCls},
|
||||||
content: Messages.user_rename
|
content: Messages.user_rename
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (accountName) {
|
if (accountName && !AppConfig.disableProfile) {
|
||||||
options.push({
|
options.push({
|
||||||
tag: 'a',
|
tag: 'a',
|
||||||
attributes: {'class': 'cp-toolbar-menu-profile'},
|
attributes: {'class': 'cp-toolbar-menu-profile'},
|
||||||
|
|||||||
@ -238,55 +238,57 @@ define([
|
|||||||
var $nameValue = $('<span>', {
|
var $nameValue = $('<span>', {
|
||||||
'class': 'cp-toolbar-userlist-name-value'
|
'class': 'cp-toolbar-userlist-name-value'
|
||||||
}).text(name).appendTo($nameSpan);
|
}).text(name).appendTo($nameSpan);
|
||||||
var $button = $('<button>', {
|
if (!Config.disableProfile) {
|
||||||
'class': 'fa fa-pencil cp-toolbar-userlist-name-edit',
|
var $button = $('<button>', {
|
||||||
title: Messages.user_rename
|
'class': 'fa fa-pencil cp-toolbar-userlist-name-edit',
|
||||||
}).appendTo($nameSpan);
|
title: Messages.user_rename
|
||||||
$button.hover(function (e) { e.preventDefault(); e.stopPropagation(); });
|
}).appendTo($nameSpan);
|
||||||
$button.mouseenter(function (e) {
|
$button.hover(function (e) { e.preventDefault(); e.stopPropagation(); });
|
||||||
e.preventDefault();
|
$button.mouseenter(function (e) {
|
||||||
e.stopPropagation();
|
e.preventDefault();
|
||||||
window.setTimeout(function () {
|
e.stopPropagation();
|
||||||
$button.parents().mouseleave();
|
window.setTimeout(function () {
|
||||||
|
$button.parents().mouseleave();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
var $nameInput = $('<input>', {
|
||||||
var $nameInput = $('<input>', {
|
'class': 'cp-toolbar-userlist-name-input'
|
||||||
'class': 'cp-toolbar-userlist-name-input'
|
}).val(name).appendTo($rightCol);
|
||||||
}).val(name).appendTo($rightCol);
|
$button.click(function (e) {
|
||||||
$button.click(function (e) {
|
e.stopPropagation();
|
||||||
e.stopPropagation();
|
$nameSpan.hide();
|
||||||
$nameSpan.hide();
|
$nameInput.show().focus().select();
|
||||||
$nameInput.show().focus().select();
|
editingUserName.state = true;
|
||||||
editingUserName.state = true;
|
editingUserName.oldName = $nameInput.val();
|
||||||
editingUserName.oldName = $nameInput.val();
|
});
|
||||||
});
|
$nameInput.click(function (e) {
|
||||||
$nameInput.click(function (e) {
|
e.stopPropagation();
|
||||||
e.stopPropagation();
|
});
|
||||||
});
|
$nameInput.on('keydown', function (e) {
|
||||||
$nameInput.on('keydown', function (e) {
|
if (e.which === 13 || e.which === 27) {
|
||||||
if (e.which === 13 || e.which === 27) {
|
$nameInput.hide();
|
||||||
$nameInput.hide();
|
$nameSpan.show();
|
||||||
$nameSpan.show();
|
$button.show();
|
||||||
$button.show();
|
editingUserName.state = false;
|
||||||
editingUserName.state = false;
|
}
|
||||||
|
if (e.which === 13) {
|
||||||
|
var newName = $nameInput.val(); // TODO clean
|
||||||
|
$nameValue.text(newName);
|
||||||
|
setDisplayName(newName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.which === 27) {
|
||||||
|
$nameValue.text(editingUserName.oldName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (editingUserName.state) {
|
||||||
|
$button.click();
|
||||||
|
$nameInput.val(editingUserName.value);
|
||||||
|
$nameInput[0].setSelectionRange(editingUserName.select[0],
|
||||||
|
editingUserName.select[1]);
|
||||||
|
setTimeout(function () { $nameInput.focus(); });
|
||||||
}
|
}
|
||||||
if (e.which === 13) {
|
|
||||||
var newName = $nameInput.val(); // TODO clean
|
|
||||||
$nameValue.text(newName);
|
|
||||||
setDisplayName(newName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (e.which === 27) {
|
|
||||||
$nameValue.text(editingUserName.oldName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (editingUserName.state) {
|
|
||||||
$button.click();
|
|
||||||
$nameInput.val(editingUserName.value);
|
|
||||||
$nameInput[0].setSelectionRange(editingUserName.select[0],
|
|
||||||
editingUserName.select[1]);
|
|
||||||
setTimeout(function () { $nameInput.focus(); });
|
|
||||||
}
|
}
|
||||||
} else if (Common.isLoggedIn() && data.curvePublic && !friends[data.curvePublic]
|
} else if (Common.isLoggedIn() && data.curvePublic && !friends[data.curvePublic]
|
||||||
&& !priv.readOnly) {
|
&& !priv.readOnly) {
|
||||||
|
|||||||
@ -9,6 +9,7 @@ define([
|
|||||||
'/common/common-interface.js',
|
'/common/common-interface.js',
|
||||||
'/common/common-realtime.js',
|
'/common/common-realtime.js',
|
||||||
'/customize/messages.js',
|
'/customize/messages.js',
|
||||||
|
'/customize/application_config.js',
|
||||||
'/bower_components/marked/marked.min.js',
|
'/bower_components/marked/marked.min.js',
|
||||||
'cm/lib/codemirror',
|
'cm/lib/codemirror',
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ define([
|
|||||||
UI,
|
UI,
|
||||||
Realtime,
|
Realtime,
|
||||||
Messages,
|
Messages,
|
||||||
|
AppConfig,
|
||||||
Marked,
|
Marked,
|
||||||
CodeMirror
|
CodeMirror
|
||||||
)
|
)
|
||||||
@ -478,6 +480,10 @@ define([
|
|||||||
$(waitFor(UI.addLoadingScreen));
|
$(waitFor(UI.addLoadingScreen));
|
||||||
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
|
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
|
||||||
}).nThen(function (waitFor) {
|
}).nThen(function (waitFor) {
|
||||||
|
if (AppConfig.disableProfile) {
|
||||||
|
common.gotoURL('/drive/');
|
||||||
|
return;
|
||||||
|
}
|
||||||
APP.$container = $('#cp-sidebarlayout-container');
|
APP.$container = $('#cp-sidebarlayout-container');
|
||||||
APP.$toolbar = $('#cp-toolbar');
|
APP.$toolbar = $('#cp-toolbar');
|
||||||
APP.$leftside = $('<div>', {id: 'cp-sidebarlayout-leftside'}).appendTo(APP.$container);
|
APP.$leftside = $('<div>', {id: 'cp-sidebarlayout-leftside'}).appendTo(APP.$container);
|
||||||
|
|||||||
@ -74,6 +74,10 @@ define([
|
|||||||
var feedbackIdx = categories.account.indexOf('cp-settings-userfeedback');
|
var feedbackIdx = categories.account.indexOf('cp-settings-userfeedback');
|
||||||
categories.account.splice(feedbackIdx, 1);
|
categories.account.splice(feedbackIdx, 1);
|
||||||
}
|
}
|
||||||
|
if (AppConfig.disableProfile) {
|
||||||
|
var displaynameIdx = categories.account.indexOf('cp-settings-displayname');
|
||||||
|
categories.account.splice(displaynameIdx, 1);
|
||||||
|
}
|
||||||
|
|
||||||
var create = {};
|
var create = {};
|
||||||
|
|
||||||
@ -159,8 +163,7 @@ define([
|
|||||||
create['logout-everywhere'] = function () {
|
create['logout-everywhere'] = function () {
|
||||||
if (!common.isLoggedIn()) { return; }
|
if (!common.isLoggedIn()) { return; }
|
||||||
var $div = $('<div>', { 'class': 'cp-settings-logout-everywhere cp-sidebarlayout-element'});
|
var $div = $('<div>', { 'class': 'cp-settings-logout-everywhere cp-sidebarlayout-element'});
|
||||||
$('<label>', { 'for': 'cp-settings-logout-everywhere'})
|
$('<label>').text(Messages.settings_logoutEverywhereTitle).appendTo($div);
|
||||||
.text(Messages.settings_logoutEverywhereTitle).appendTo($div);
|
|
||||||
$('<span>', {'class': 'cp-sidebarlayout-description'})
|
$('<span>', {'class': 'cp-sidebarlayout-description'})
|
||||||
.text(Messages.settings_logoutEverywhere).appendTo($div);
|
.text(Messages.settings_logoutEverywhere).appendTo($div);
|
||||||
var $button = $('<button>', {
|
var $button = $('<button>', {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user