hide references to registration if registration is disabled

pull/1/head
ansuz 4 years ago
parent 18c73ad282
commit 8546e7b317

@ -146,7 +146,7 @@ define([
]), ]),
]); ]);
var availableFeatures = var availableFeatures =
(Config.allowSubscriptions && accounts.upgradeURL) ? (Config.allowSubscriptions && accounts.upgradeURL && !Config.restrictRegistration) ?
[anonymousFeatures, registeredFeatures, premiumFeatures] : [anonymousFeatures, registeredFeatures, premiumFeatures] :
[anonymousFeatures, registeredFeatures]; [anonymousFeatures, registeredFeatures];

@ -2,8 +2,9 @@ define([
'/common/hyperscript.js', '/common/hyperscript.js',
'/common/common-interface.js', '/common/common-interface.js',
'/customize/messages.js', '/customize/messages.js',
'/customize/pages.js' '/customize/pages.js',
], function (h, UI, Msg, Pages) { '/api/config',
], function (h, UI, Msg, Pages, Config) {
return function () { return function () {
return [h('div#cp-main', [ return [h('div#cp-main', [
Pages.infopageTopbar(), Pages.infopageTopbar(),
@ -32,7 +33,10 @@ define([
]), ]),
h('div.extra', [ h('div.extra', [
h('button.login', Msg.login_login), h('button.login', Msg.login_login),
(Config.restrictRegistration?
undefined:
h('button#register.cp-secondary', Msg.login_register) h('button#register.cp-secondary', Msg.login_register)
)
]) ])
]), ]),
h('div.col-md-3') h('div.col-md-3')

@ -16,11 +16,28 @@ define([
tabindex: '-1', tabindex: '-1',
}); });
return [h('div#cp-main', [
var frame = function (content) {
return [
h('div#cp-main', [
Pages.infopageTopbar(), Pages.infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('div.row.cp-page-title', h('h1', Msg.register_header)), h('div.row.cp-page-title', h('h1', Msg.register_header)),
h('div.row.cp-register-det', [ h('div.row.cp-register-det', content),
]),
]),
Pages.infopageFooter(),
];
};
if (Config.restrictRegistration) { // XXX restricted-registration
Msg.register_closed = "This instance does not allow registration at the moment.";
return frame([
h('h4', Msg.register_closed)
]);
}
return frame([
h('div#data.hidden.col-md-6', [ h('div#data.hidden.col-md-6', [
h('h2', Msg.register_notes_title), h('h2', Msg.register_notes_title),
Pages.setHTML(h('div.cp-register-notes'), Msg.register_notes) Pages.setHTML(h('div.cp-register-notes'), Msg.register_notes)
@ -59,11 +76,7 @@ define([
h('button#register', Msg.login_register) h('button#register', Msg.login_register)
]) ])
]), ]),
]), ]);
]),
Pages.infopageFooter(),
])];
}; };
}); });

@ -1833,6 +1833,7 @@ define([
Common.setLoginRedirect('login'); Common.setLoginRedirect('login');
}, },
}); });
if (!Config.restrictRegistration) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'cp-toolbar-menu-register fa fa-user-plus'}, attributes: {'class': 'cp-toolbar-menu-register fa fa-user-plus'},
@ -1842,6 +1843,7 @@ define([
}, },
}); });
} }
}
var $icon = $('<span>', {'class': 'fa fa-user-secret'}); var $icon = $('<span>', {'class': 'fa fa-user-secret'});
//var $userbig = $('<span>', {'class': 'big'}).append($displayedName.clone()); //var $userbig = $('<span>', {'class': 'big'}).append($displayedName.clone());
var $userButton = $('<div>').append($icon);//.append($userbig); var $userButton = $('<div>').append($icon);//.append($userbig);

@ -11,18 +11,12 @@ define([
'/common/common-feedback.js', '/common/common-feedback.js',
'/common/outer/local-store.js', '/common/outer/local-store.js',
'/common/hyperscript.js', '/common/hyperscript.js',
'/api/config',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
], function ($, Login, Cryptpad, Test, Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h, ApiConfig) { ], function ($, Login, Cryptpad, Test, Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h) {
var Messages = Cryptpad.Messages; var Messages = Cryptpad.Messages;
Messages.register_registrationIsClosed = "REGISTRATION IS CLOSED ON THIS INSTANCE."; // XXX Messages.register_registrationIsClosed = "REGISTRATION IS CLOSED ON THIS INSTANCE."; // XXX
$(function () { $(function () {
if (ApiConfig.restrictRegistration) {
return void UI.alert(Messages.register_registrationIsClosed); // XXX restricted-registration better UI ?
// remove the form and display text instead of an alert that people will probably dismiss?
}
if (LocalStore.isLoggedIn()) { if (LocalStore.isLoggedIn()) {
// already logged in, redirect to drive // already logged in, redirect to drive
document.location.href = '/drive/'; document.location.href = '/drive/';

Loading…
Cancel
Save