feat: add option to disable temporary users

This commit is contained in:
Nariman Jelveh
2024-07-18 12:59:42 -04:00
committed by GitHub
parent ba50d0f96d
commit f9333b3d1e
5 changed files with 12 additions and 4 deletions
+3 -1
View File
@@ -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
+3 -1
View File
@@ -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,
},
}));
}