A security plugin for the Flatboard forum application (flatboard.org) that enforces mandatory registration code requirements for user registration. Provides an administrative interface to configure a secret code and a customizable help message displayed on the registration form.
- Description
- Features
- Installation
- Usage
- Configuration
- System Requirements
- Security Features
- API Endpoints
- Internationalization
- Contributing
- License
The Registration Code Plugin adds an additional layer of security to your Flatboard forum by requiring users to enter a secret code during registration. This prevents unauthorized sign-ups and helps control access to your forum. Administrators can easily configure the registration code and customize the help message displayed to users through the Flatboard admin panel.
This plugin integrates seamlessly with Flatboard's plugin system and extends the standard registration flow to enforce code validation before allowing new user accounts to be created.
- Mandatory Registration Code: Requires users to enter a valid code before registration on Flatboard
- Admin Configuration Interface: Easy-to-use Flatboard admin panel for code and message management
- Real-time Validation: AJAX-based validation with instant feedback
- Client-side Validation: JavaScript validation for immediate user feedback
- Security Logging: Automatic logging of failed registration attempts for monitoring
- Input Sanitization: All user inputs are sanitized to prevent XSS attacks
- Internationalization: Built-in support for English and French languages
- Customizable Help Message: Display contextual information to guide users
- Seamless Integration: Hooks into Flatboard's registration form automatically
Ensure your Flatboard installation meets the System Requirements before installation.
- Clone the repository:
git clone https://github.com/ilogeek/flatboard-registrationcode.git /path/to/plugins/registrationCode- Verify the plugin structure:
/plugins/registrationCode/
├── plugin.json
├── RegistrationCodePlugin.php
├── langs/
│ ├── en.json
│ └── fr.json
├── assets/
│ └── js/
│ └── registration.js
└── README.md
-
Activate the plugin through the Flatboard admin panel:
- Navigate to Admin > Plugins
- Find "Registration Code" in the plugin list
- Click "Activate" or set
"active": "1"in the plugin configuration
-
Configure the plugin by accessing the plugin settings page and setting your registration code and help message.
Once installed and activated, the plugin automatically:
- Injects a registration code field into the Flatboard registration form
- Validates the code before allowing registration to proceed
- Displays the help message below the code field
- Logs failed attempts for security monitoring
Users will see an additional field on the Flatboard registration page:
<label for="registration_code">Registration Code</label>
<input
type="text"
id="registration_code"
name="registration_code"
required
placeholder="Enter registration code"
autocomplete="off"
>
<small class="form-text text-muted">Contact the administrator to obtain the registration code.</small>Access the plugin settings through the Flatboard admin panel:
- Navigate to Admin > Plugins > Registration Code
- Configure the following settings:
- Registration Code: The secret code users must enter
- Help Message: Custom message displayed below the input field
The plugin can be configured through the Flatboard admin interface or by editing plugin.json:
| Setting | Type | Default | Description |
|---|---|---|---|
code |
string | CODE-SECR3T |
The secret registration code required for user registration |
message |
string | Contact the administrator to obtain the registration code. |
Help message displayed on the registration form |
{
"settings": {
"code": "MY-SECRET-CODE",
"message": "Please contact support@yourdomain.com to request access."
}
}- Flatboard Version: 5.0.0 or higher
- PHP Version: 7.4 or higher
- Extensions:
- JSON extension (for plugin configuration)
- Session support
- Web Server: Apache with mod_rewrite or Nginx
- Browser Support: Modern browsers with JavaScript enabled
All user inputs are sanitized using Flatboard's Sanitizer class to prevent XSS attacks:
$submittedCode = $this->sanitizeInput($request->get('registration_code'));Invalid registration code attempts are logged for security monitoring:
Logger::security('Invalid registration code attempt', [
'ip' => $request->getIp(),
'submitted_code' => $submittedCode,
'timestamp' => date('Y-m-d H:i:s')
]);The plugin integrates with Flatboard's CSRF middleware for form protection.
Validates a registration code via AJAX.
Endpoint: POST /api/plugins/registrationcode/validate
Request Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
registration_code |
string | Yes | The registration code to validate |
Response:
Success (200):
{
"valid": true
}Failure (200):
{
"valid": false,
"message": "Invalid registration code. Please contact the administrator for access."
}The plugin intercepts the standard Flatboard registration endpoint to enforce code validation.
Endpoint: POST /register
Request Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
registration_code |
string | Yes | The registration code |
| ... | ... | ... | Standard Flatboard registration fields |
The plugin supports multiple languages through JSON language files.
- English (
en) - French (
fr) - Default
- Create a new language file in the
langs/directory (e.g.,es.json) - Follow the structure of existing language files:
{
"registrationCode": {
"field": {
"label": "Registration Code",
"placeholder": "Enter registration code"
},
"validation": {
"codeRequired": "Please enter a registration code.",
"codeInvalidPattern": "Registration code can only contain letters, numbers, and hyphens.",
"codeInvalid": "Invalid registration code. Please contact the administrator for access.",
"validationError": "Error validating registration code. Please try again."
}
},
"code_help": "The secret code users must enter to register.",
"message_help": "This message will be displayed below the registration code field on the registration form to help users understand how to obtain access."
}- Update the
plugin.jsonfile to include the new language:
{
"i18n": {
"languages": ["en", "fr", "es"],
"directory": "langs",
"default": "fr"
}
}Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes following the existing code style
- Test thoroughly on a Flatboard development environment
- Follow PSR-12 coding standards for PHP
- Use descriptive variable and function names
- Add inline comments for complex logic
- Maintain existing documentation
- Commit your changes with clear messages
- Push to your fork:
git push origin feature/my-feature - Submit a pull request with a description of your changes
If you find a bug or have a feature request:
- Check existing issues to avoid duplicates
- Create a new issue with:
- Clear title and description
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- Environment details (PHP version, Flatboard version)
- Relevant logs or screenshots
This plugin is licensed under the MIT License. See the LICENSE file for details.
Hugo Zilliox
- Homepage: https://hzilliox.fr
- Repository: https://github.com/ilogeek/flatboard-registrationcode
For support, questions, or feature requests, please:
- Open an issue on GitHub
- Visit the project homepage
- Contact the author through the official website
- Visit Flatboard for community support
Note: This plugin is designed specifically for the Flatboard forum application (flatboard.org). Ensure you are using a compatible version of Flatboard (5.0.0 or higher) before installation.