Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apostrophecms-legacy/apostrophe-forms-regexp-text-field-widgets
Text fields that safely allow custom regular expression checks, for Apostrophe Forms
https://github.com/apostrophecms-legacy/apostrophe-forms-regexp-text-field-widgets
Last synced: 1 day ago
JSON representation
Text fields that safely allow custom regular expression checks, for Apostrophe Forms
- Host: GitHub
- URL: https://github.com/apostrophecms-legacy/apostrophe-forms-regexp-text-field-widgets
- Owner: apostrophecms-legacy
- Created: 2020-07-15T19:15:10.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-07-21T13:34:10.000Z (over 4 years ago)
- Last Synced: 2024-12-26T11:08:08.514Z (1 day ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
This module adds a new type of text field that allows the admin to specify their own regular expression. It is meant for use alongside the `apostrophe-forms` module.
## Configuration
```javascript
// in app.js
modules: {
'apostrophe-forms': {
formWidgets: {
// other fields go here
'apostrophe-forms-regexp-text-field': {}
}
},
'apostrophe-forms-regexp-text-field-widgets'
}
```## Preventing DOS (Denial of Service) attacks
Since [many regular expressions can run for hours on malicious input](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS), which could completely block the site, this module uses the [time-limited-regular-expressions](https://github.com/apostrophecms/time-limited-regular-expressions) module to limit the runtime to one-quarter second. This will not be an issue on reasonable input. If you do get a timeout message when testing your form, you should write a more efficient regular expression.