Fix jwt-token
This commit is contained in:
30
server/migrations/20250914-add-allow-registration.js
Normal file
30
server/migrations/20250914-add-allow-registration.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Migration: Add allow_registration field to tenants table
|
||||
* This field controls whether self-registration is allowed for local auth tenants
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.addColumn('tenants', 'allow_registration', {
|
||||
type: Sequelize.BOOLEAN,
|
||||
defaultValue: false, // Default to false for security
|
||||
allowNull: false,
|
||||
comment: 'Whether self-registration is allowed for local auth'
|
||||
});
|
||||
|
||||
// For existing tenants, you might want to enable registration for specific tenants
|
||||
// Uncomment the line below to enable registration for all existing tenants (NOT RECOMMENDED for production)
|
||||
// await queryInterface.sequelize.query("UPDATE tenants SET allow_registration = true WHERE auth_provider = 'local'");
|
||||
|
||||
console.log('✅ Added allow_registration field to tenants table');
|
||||
console.log('⚠️ Registration is disabled by default for all tenants for security');
|
||||
console.log('💡 To enable registration for a tenant, update the allow_registration field to true');
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.removeColumn('tenants', 'allow_registration');
|
||||
console.log('✅ Removed allow_registration field from tenants table');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user