Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strapi v5 #45

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .eslintrc.js

This file was deleted.

215 changes: 118 additions & 97 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,118 +1,139 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

############################
# OS X
############################

.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*


############################
# Linux
############################

*~


############################
# Windows
############################

Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp


############################
# Packages
############################

*.7z
*.csv
*.dat
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.com
*.class
*.dll
*.exe
*.o
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript
*.so
*.swo
*.swp
*.swn
*.swm
*.out
*.pid

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/
############################
# Logs and databases
############################

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
.tmp
*.log
*.sql
*.sqlite
*.sqlite3

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm
############################
# Misc.
############################

# Optional eslint cache
*#
ssl
.idea
nbproject
.tsbuildinfo
.eslintcache
.env

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity
############################
# Strapi
############################

# dotenv environment variables file
.env
.env.test
.env.production
public/uploads/*
!public/uploads/.gitkeep

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out
############################
# Build
############################

# Nuxt.js build / generate output
.nuxt
dist
build
cache

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/
############################
# Node.js
############################

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
lib-cov
lcov.info
pids
logs
results
node_modules
.node_history


############################
# Package managers
############################

.yarn/*
!.yarn/cache
!.yarn/unplugged
!.yarn/patches
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
yarn-error.log

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
############################
# Tests
############################

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
coverage
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 80,
"endOfLine": "lf",
"semi": true,
"tabWidth": 2,
"trailingComma": "es5",
"plugins": ["@ianvs/prettier-plugin-sort-imports"]
}
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

<p align="center">
<img src="https://user-images.githubusercontent.com/25715982/152631378-2964a94b-bc53-435f-9812-c2880e497cb3.png" alt="EZ forms"/>
</p>

# Strapi Forms Plugin

_This plugin only supports Strapi v4_
_This plugin only supports Strapi v5_
_For Strapi v4 support, please use *v0.1.7*_

This plugin allows you to easily consume forms from your front end and automatically reject spam, send out
notifications, and store the data in your database.


_Objective:_

_The objective of ez forms is to have a really simple and fast way to integrate forms with notifications without a lot of setup. We will be continuing to build features but we are going to keep this plugin simple to setup. Meaning features like server side form validation and heavy customiztations will most likely never be added to this forms plugin. If you need something more customized you should look into making a custom controller._
_The objective of ez forms is to have a really simple and fast way to integrate forms with notifications without a lot of setup. We will be continuing to build features but we are going to keep this plugin simple to setup. Meaning features like server side form validation and heavy customiztations will most likely never be added to this forms plugin. If you need something more customized you should look into making a custom controller._

## Docs

Expand All @@ -35,21 +34,22 @@ Security issues should be reported using the [security tab](https://github.com/e

## Links

- [NPM Package](https://www.npmjs.com/package/strapi-plugin-ezforms)
- [Github](https://github.com/excl-networks/strapi-plugin-ezforms)
- [MIT License](LICENSE.md)
- [NPM Package](https://www.npmjs.com/package/strapi-plugin-ezforms)
- [Github](https://github.com/excl-networks/strapi-plugin-ezforms)
- [MIT License](LICENSE.md)

## TODO

- [ ] Add more captcha providers
- [ ] Add more notification providers
- [ ] Allow disabling db write
- [ ] Make emails pretty (see custom formatting)
- [x] Allow providers to be extendable on a per project basis (similar to how email providers work)
- [ ] Allow selection which notifications are sent to which people
- [ ] Convert to TS
- [x] Add eslint
- [x] Remove Twilio SDK in favor of HTTP
- [ ] Add more captcha providers
- [ ] Add more notification providers
- [ ] Allow disabling db write
- [ ] Make emails pretty (see custom formatting)
- [x] Allow providers to be extendable on a per project basis (similar to how email providers work)
- [ ] Allow selection which notifications are sent to which people
- [x] Convert to TS
- [x] Add eslint
- [x] Remove Twilio SDK in favor of HTTP

## ⭐️Did you find this helpful?

If you found this plugin helpful give it a star?
29 changes: 11 additions & 18 deletions docs/advanced/custom-controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ EzForms comes with a default controller that handles the form submission. Howeve

You can create a custom controlling by following the instructions in the [Official Strapi Docs](https://docs.strapi.io/developer-docs/latest/development/backend-customization/controllers.html)


### Captcha Providers

```js

// Call captcha provider function

strapi.plugin('ezforms').service('recaptcha').validate(ctx.request.body.token)

strapi.plugin("ezforms").service("recaptcha").validate(ctx.request.body.token);
```

Captcha providers will return an object with a valid property

```js
// invalid captcha
return {
Expand All @@ -36,30 +34,25 @@ return {

You can use any of the notification providers that come with EzForms or you can create your own. Each provider takes a config variable which you can view the required data [here](/notification-providers) and data which is the formData.


```js
// Twilio Example
let config = {
accountSid: 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
authToken: 'your_auth_token',
from: '+12345678901',
}
accountSid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
authToken: "your_auth_token",
from: "+12345678901",
};
let data = {
name: 'John Doe',
email: '[email protected]'
}
name: "John Doe",
email: "[email protected]",
};

strapi.plugin('ezforms').service('twilio').send(config, data)
strapi.plugin("ezforms").service("twilio").send(config, data);
```


### formatData

The formatData function takes the data object and formats it into a string that can be used in a notification.

```js
strapi.plugin('ezforms').service('formatData').formatData(data)
strapi.plugin("ezforms").service("formatData").formatData(data);
```



Loading