hide references to registration if registration is disabled
parent
18c73ad282
commit
8546e7b317
|
@ -146,7 +146,7 @@ define([
|
|||
]),
|
||||
]);
|
||||
var availableFeatures =
|
||||
(Config.allowSubscriptions && accounts.upgradeURL) ?
|
||||
(Config.allowSubscriptions && accounts.upgradeURL && !Config.restrictRegistration) ?
|
||||
[anonymousFeatures, registeredFeatures, premiumFeatures] :
|
||||
[anonymousFeatures, registeredFeatures];
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@ define([
|
|||
'/common/hyperscript.js',
|
||||
'/common/common-interface.js',
|
||||
'/customize/messages.js',
|
||||
'/customize/pages.js'
|
||||
], function (h, UI, Msg, Pages) {
|
||||
'/customize/pages.js',
|
||||
'/api/config',
|
||||
], function (h, UI, Msg, Pages, Config) {
|
||||
return function () {
|
||||
return [h('div#cp-main', [
|
||||
Pages.infopageTopbar(),
|
||||
|
@ -32,7 +33,10 @@ define([
|
|||
]),
|
||||
h('div.extra', [
|
||||
h('button.login', Msg.login_login),
|
||||
h('button#register.cp-secondary', Msg.login_register)
|
||||
(Config.restrictRegistration?
|
||||
undefined:
|
||||
h('button#register.cp-secondary', Msg.login_register)
|
||||
)
|
||||
])
|
||||
]),
|
||||
h('div.col-md-3')
|
||||
|
|
|
@ -16,54 +16,67 @@ define([
|
|||
tabindex: '-1',
|
||||
});
|
||||
|
||||
return [h('div#cp-main', [
|
||||
Pages.infopageTopbar(),
|
||||
h('div.container.cp-container', [
|
||||
h('div.row.cp-page-title', h('h1', Msg.register_header)),
|
||||
h('div.row.cp-register-det', [
|
||||
h('div#data.hidden.col-md-6', [
|
||||
h('h2', Msg.register_notes_title),
|
||||
Pages.setHTML(h('div.cp-register-notes'), Msg.register_notes)
|
||||
]),
|
||||
h('div.cp-reg-form.col-md-6', [
|
||||
h('img.img-fluid', {
|
||||
src: '/customize/images/swallow-the-key.png?' + urlArgs
|
||||
}),
|
||||
h('div#userForm.form-group.hidden', [
|
||||
h('a', {
|
||||
href: '/features.html'
|
||||
}, Msg.register_whyRegister),
|
||||
h('input.form-control#username', {
|
||||
type: 'text',
|
||||
autocomplete: 'off',
|
||||
autocorrect: 'off',
|
||||
autocapitalize: 'off',
|
||||
spellcheck: false,
|
||||
placeholder: Msg.login_username,
|
||||
autofocus: true,
|
||||
}),
|
||||
h('input.form-control#password', {
|
||||
type: 'password',
|
||||
placeholder: Msg.login_password,
|
||||
}),
|
||||
h('input.form-control#password-confirm', {
|
||||
type: 'password',
|
||||
placeholder: Msg.login_confirm,
|
||||
}),
|
||||
h('div.checkbox-container', [
|
||||
UI.createCheckbox('import-recent', Msg.register_importRecent, true)
|
||||
]),
|
||||
h('div.checkbox-container', [
|
||||
tos,
|
||||
]),
|
||||
h('button#register', Msg.login_register)
|
||||
])
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
|
||||
Pages.infopageFooter(),
|
||||
])];
|
||||
var frame = function (content) {
|
||||
return [
|
||||
h('div#cp-main', [
|
||||
Pages.infopageTopbar(),
|
||||
h('div.container.cp-container', [
|
||||
h('div.row.cp-page-title', h('h1', Msg.register_header)),
|
||||
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('h2', Msg.register_notes_title),
|
||||
Pages.setHTML(h('div.cp-register-notes'), Msg.register_notes)
|
||||
]),
|
||||
h('div.cp-reg-form.col-md-6', [
|
||||
h('img.img-fluid', {
|
||||
src: '/customize/images/swallow-the-key.png?' + urlArgs
|
||||
}),
|
||||
h('div#userForm.form-group.hidden', [
|
||||
h('a', {
|
||||
href: '/features.html'
|
||||
}, Msg.register_whyRegister),
|
||||
h('input.form-control#username', {
|
||||
type: 'text',
|
||||
autocomplete: 'off',
|
||||
autocorrect: 'off',
|
||||
autocapitalize: 'off',
|
||||
spellcheck: false,
|
||||
placeholder: Msg.login_username,
|
||||
autofocus: true,
|
||||
}),
|
||||
h('input.form-control#password', {
|
||||
type: 'password',
|
||||
placeholder: Msg.login_password,
|
||||
}),
|
||||
h('input.form-control#password-confirm', {
|
||||
type: 'password',
|
||||
placeholder: Msg.login_confirm,
|
||||
}),
|
||||
h('div.checkbox-container', [
|
||||
UI.createCheckbox('import-recent', Msg.register_importRecent, true)
|
||||
]),
|
||||
h('div.checkbox-container', [
|
||||
tos,
|
||||
]),
|
||||
h('button#register', Msg.login_register)
|
||||
])
|
||||
]),
|
||||
]);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -1833,14 +1833,16 @@ define([
|
|||
Common.setLoginRedirect('login');
|
||||
},
|
||||
});
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: {'class': 'cp-toolbar-menu-register fa fa-user-plus'},
|
||||
content: h('span', Messages.login_register),
|
||||
action: function () {
|
||||
Common.setLoginRedirect('register');
|
||||
},
|
||||
});
|
||||
if (!Config.restrictRegistration) {
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: {'class': 'cp-toolbar-menu-register fa fa-user-plus'},
|
||||
content: h('span', Messages.login_register),
|
||||
action: function () {
|
||||
Common.setLoginRedirect('register');
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
var $icon = $('<span>', {'class': 'fa fa-user-secret'});
|
||||
//var $userbig = $('<span>', {'class': 'big'}).append($displayedName.clone());
|
||||
|
|
|
@ -11,18 +11,12 @@ define([
|
|||
'/common/common-feedback.js',
|
||||
'/common/outer/local-store.js',
|
||||
'/common/hyperscript.js',
|
||||
'/api/config',
|
||||
|
||||
'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;
|
||||
Messages.register_registrationIsClosed = "REGISTRATION IS CLOSED ON THIS INSTANCE."; // XXX
|
||||
$(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()) {
|
||||
// already logged in, redirect to drive
|
||||
document.location.href = '/drive/';
|
||||
|
|
Loading…
Reference in New Issue