v1.18.x
Baris Soner Usakli 11 years ago
parent 8fd78199e2
commit f68f02d346

@ -77,6 +77,11 @@
<form>
<h3>User Settings</h3>
<div class="alert alert-warning">
<div class="checkbox">
<label>
<input type="checkbox" data-field="allowRegistration" checked> <strong>Allow registration</strong>
</label>
</div>
<strong>Minimum Username Length</strong><br />
<input type="text" class="form-control" value="2" data-field="minimumUsernameLength"><br />
<strong>Maximum Username Length</strong><br />

@ -112,9 +112,11 @@
</ul>
<ul id="logged-out-menu" class="nav navbar-nav navbar-right">
<!-- IF allowRegistration -->
<li class="visible-lg visible-md visible-sm">
<a href="/register">[[global:register]]</a>
</li>
<!-- ENDIF allowRegistration -->
<li class="visible-lg visible-md visible-sm">
<a href="/login">[[global:login]]</a>
</li>

@ -37,6 +37,7 @@ var path = require('path'),
config.maximumSignatureLength = meta.config.maximumSignatureLength;
config.useOutgoingLinksPage = meta.config.useOutgoingLinksPage;
config.allowGuestPosting = meta.config.allowGuestPosting;
config.allowRegistration = meta.config.allowRegistration || '1';
config.emailSetup = !!meta.config['email:from'];
res.json(200, config);

@ -193,6 +193,10 @@
});
app.post('/register', function(req, res) {
if(parseInt(meta.config.allowRegistration, 10) === 0) {
return res.send(403);
}
user.create(req.body.username, req.body.password, req.body.email, function(err, uid) {
if (err === null && uid) {
req.login({

@ -98,7 +98,8 @@ var path = require('path'),
link_tags: linkTags,
clientScripts: clientScripts,
navigation: custom_header.navigation,
'cache-buster': meta.config['cache-buster'] ? '?v=' + meta.config['cache-buster'] : ''
'cache-buster': meta.config['cache-buster'] ? '?v=' + meta.config['cache-buster'] : '',
allowRegistration: parseInt(meta.config.allowRegistration, 10) === 1
};
var uid = '0';
@ -389,6 +390,8 @@ var path = require('path'),
res.redirect('/user/' + userslug);
});
return;
} else if(route === 'register' && parseInt(meta.config.allowRegistration, 10) === 0) {
return res.redirect('/403');
} else if (loginRequired.indexOf(route) !== -1 && !req.user) {
return res.redirect('/403');
}

Loading…
Cancel
Save