mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-23 13:46:11 +00:00
feat: add option to disable temporary users
This commit is contained in:
@@ -25,6 +25,9 @@ let config = {};
|
||||
// Static defaults
|
||||
config.servers = [];
|
||||
|
||||
// Will disable the auto-generated temp users. If a user lands on the site, they will be required to sign up or log in.
|
||||
config.disable_temp_users = false;
|
||||
|
||||
config.max_file_size = 100_000_000_000,
|
||||
config.max_thumb_size = 1_000,
|
||||
config.max_fsentry_name_length = 767,
|
||||
@@ -131,7 +134,6 @@ const config_pointer = {};
|
||||
config_to_export = config_pointer;
|
||||
}
|
||||
|
||||
|
||||
// We have some methods that can be called on `config`
|
||||
{
|
||||
// Add configuration values with precedence over the current config
|
||||
|
||||
@@ -100,10 +100,12 @@ module.exports = eggspress(['/signup'], {
|
||||
}
|
||||
|
||||
// temporary user
|
||||
if(req.body.is_temp){
|
||||
if(req.body.is_temp && !config.disable_temp_users){
|
||||
req.body.username = await generate_random_username();
|
||||
req.body.email = req.body.username + '@gmail.com';
|
||||
req.body.password = 'sadasdfasdfsadfsa';
|
||||
}else if(config.disable_temp_users){
|
||||
return res.status(400).send('Temp users are disabled.');
|
||||
}
|
||||
|
||||
// send_confirmation_code
|
||||
|
||||
@@ -108,6 +108,7 @@ class PuterHomepageService extends BaseService {
|
||||
require_email_verification_to_publish_website: config.require_email_verification_to_publish_website,
|
||||
short_description: config.short_description,
|
||||
long_description: config.long_description,
|
||||
disable_temp_users: config.disable_temp_users,
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user