GitXplorerGitXplorer
j

nest-google-recaptcha

public
8 stars
2 forks
1 issues

Commits

List of commits on branch master.
Unverified
7f68d225dda52587ba528a9397db2867bec58333

0.2.0

jjostrander committed 4 years ago
Verified
93921ea88815594b7d4d90fc7537da993dd7f72a

Merge pull request #1 from kkent030315/master

jjostrander committed 4 years ago
Unverified
509dc7622d937f13ab2594068e9f27efab89d8e8

add v3 score validation for optional

kkkent030315 committed 4 years ago
Unverified
3013c468171c6e665f73223948280c6922ee5c70

0.1.4

jjostrander committed 5 years ago
Unverified
cc87f455d53ecfacb7ea8a0055dbc7c66c130330

Fix auto import path and HttpModule missing import

jjostrander committed 5 years ago
Unverified
5931037281b8545203070efe293ad64f33d856f2

0.1.3

jjostrander committed 5 years ago

README

The README file for this repository.

Google recaptcha module

Install

$ npm i nest-google-recaptcha

Configuration

@Module({
    imports: [
        GoogleRecaptchaModule.forRoot({
            secretKey: process.env.GOOGLE_RECAPTCHA_SECRET_KEY,
            version: 3,     // Optional, for V3
            minScore: 0.5,  // Optional, for V3
            response: req => req.headers.authorization,
            skipIf: req => process.env.NODE_ENV !== 'production',
            onError: e => {
                throw new BadRequestException('Invalid recaptcha.')
            }
        })
    ],
})
export class AppModule {
}

Usage

@Controller('feedback')
export class FeedbackController {
    @Recaptcha()
    @Post('send')
    async send(): Promise<any> {
        // TODO: Implement it.
    }
}

Enjoy!