Is it possible to disable registration?


#1

I run my own server. I’ve registered myself. I don’t want anyone else to be able to use my server. Can I disable future registrations?

Thanks!


#2

Not a clean solution, but in the interest of not making new friends while I await a good solution, I commented out the parts that seem to deal with account creation. I’ve done only the barest amount of testing, so follow at your peril.

This is the git diff of my changes:

diff --git a/controllers/users.js b/controllers/users.js
index af39470…6ac0962 100644
— a/controllers/users.js
+++ b/controllers/users.js
@@ -6,7 +6,7 @@ var analytics = require(’…/models/analytics’);
var profile_model = require(’…/models/profile’);

exports.route = function(app) {

  •   app.post('/users', join);
    

+// app.post(’/users’, join);
app.get(’/users/:user_id’, get_by_id);
app.get(’/users/email/:email’, get_by_email);
app.post(’/auth’, authenticate);
@@ -23,13 +23,13 @@ exports.route = function(app) {

  • create a new user account
    */
    var join = function(req, res) {
  •   var client = req.header('X-Turtl-Client');
    

+/* var client = req.header(‘X-Turtl-Client’);
var data = req.body;
var promise = model.join(data)
.tap(function(user) {
return analytics.track(user.id, ‘user.join’, client);
});

  •   tres.wrap(res, promise);
    
  •   tres.wrap(res, promise);*/
    

};

var get_by_id = function(req, res) {
diff --git a/models/user.js b/models/user.js
index 8022384…a940ff6 100644
— a/models/user.js
+++ b/models/user.js
@@ -116,7 +116,7 @@ exports.check_auth = function(authinfo) {
};

exports.join = function(userdata) {

  •   if(!userdata.auth) return Promise.reject(error.bad_request('missing `auth` key'));
    

+/* if(!userdata.auth) return Promise.reject(error.bad_request(‘missing auth key’));
if(!userdata.username) return Promise.reject(error.bad_request(‘missing username key (must be a valid email)’));
if(!userdata.username.match(/@/)) return Promise.reject(error.bad_request(‘please enter a valid email’));
try {
@@ -158,7 +158,7 @@ exports.join = function(userdata) {
$name: (user.data || {}).name,
});
})

  •           .then(clean_user);
    
  •           .then(clean_user);*/
    

};

Hopefully that helps somebody else.


#3

Greetings,

I found this solution described here: https://myguide.fyi/books/self-host-apps-services/page/how-to-install-turtl-server-on-debian-9-with-apache-reverseproxy-ssl

Section “# to disable further registrations edit the file:”

To be more easy to implement and to revert when needed…

Regards