captcha-com / angular-captcha Goto Github PK
View Code? Open in Web Editor NEWBotDetect CAPTCHA: Angular Captcha Module (TypeScript: Angular 2/4/5/6/7/8+).
Home Page: https://captcha.com/angular-captcha.html
BotDetect CAPTCHA: Angular Captcha Module (TypeScript: Angular 2/4/5/6/7/8+).
Home Page: https://captcha.com/angular-captcha.html
I have got this error in Captcha Validation
core.js:6456 ERROR TypeError: Cannot read properties of undefined (reading 'value') at CaptchaComponent.get [as captchaCode] (captcha.component.js:35:1) at CaptchaComponent.get [as userEnteredCaptchaCode] (captcha.component.js:42:1) at ForgetPasswordComponent.validate (forget-password.component.ts:27:55) at ForgetPasswordComponent_Template_button_click_17_listener (forget-password.component.html:33:64) at executeListenerWithErrorHandling (core.js:15281:1) at wrapListenerIn_markDirtyAndPreventDefault (core.js:15319:1) at HTMLButtonElement.<anonymous> (platform-browser.js:560:1) at ZoneDelegate.invokeTask (zone.js:406:1) at Object.onInvokeTask (core.js:28654:1) at ZoneDelegate.invokeTask (zone.js:405:1)
it seems like captchaId is undefined
my code look like this in forget-password.component.ts
` validate(value, valid): void {
let userEnteredCaptchaCode = this.captchaComponent.userEnteredCaptchaCode;
let captchaId = this.captchaComponent.captchaId;
const postData = {
userEnteredCaptchaCode: userEnteredCaptchaCode,
captchaId: captchaId
};
// post the captcha data to the backend
this.dataService.postAPI(`${this.baseUrl}/botdetectcaptcha`, postData).subscribe(
response => {
if (response.success == false) {
// captcha validation failed; reload image
this.captchaComponent.reloadImage();
// TODO: maybe display an error message, too
} else {
// TODO: captcha validation succeeded; proceed with the workflow
}
}
)
}`
Hey, I use angular-captcha with angular frontend and spring backend.
I did all the steps defined in https://captcha.com/angular-captcha.html#angular-java-spring-backend:springboot-autoconfiguration but when I call my-api-endpoint/simple-captcha-endpoint?get=html&c=yourFirstCaptchaStyle its gives me the followeing error
{ "timestamp": "2021-02-08T00:37:14.011+0000", "status": 400, "error": "Bad Request", "message": "The requested captchaStyle 'yourFirstCaptchaStyle' is not defined in the botdetect.xml!", "path": "//simple-captcha-endpoint" }
here is my botdetect.xml file content :
<?xml version="1." encodi0ng="UTF-8"?>
<botdetect xmlns="https://captcha.com/schema/java" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://captcha.com/schema/java https://captcha.com/schema/java/botdetect-4.0.beta3.7.xsd"> <captchaStyles> <captchaStyle> <name>yourFirstCaptchaStyle</name> <userInputID>yourFirstCaptchaUserInput</userInputID> </captchaStyle> </captchaStyles> </botdetect>
did I miss something ? thanks in advance
hi
i'm using your angular package on my project.
my backend project is a web api core on .net core 2.2.
when i debug the project localy everything work fine, but when i deploy to iis(8.5,10) i get this error :
here is my api configuration in startup.cs :
app.MapWhen(context => { Console.WriteLine(context.Request.Path); return context.Request.Path.ToString().EndsWith(".ashx"); }, appBuilder => { appBuilder.UseSimpleCaptcha(Configuration.GetSection("BotDetect")); } );
i went over your documentation a few times but found nothing related to this problem in .net core.
The current way of initializing the module requires the config to be specified while loading the module. We have a requirement where the endpoint is not known until needed. But there is no way to re-configure the config, as the component fires the request from onInit()
itself.
Hello, we tried to use this angular module with BotDetect captcha, but there's some problem where the test hangs and doesn't continue once we land on the captcha page.
It looks like the captcha is blocking the progress of the tests.
Notice that when we set browser.waitForAngularEnabled(false)
before the test, the test continues to run past the step where it got stuck, but as soon as I run browser.waitForAngularEnabled(true)
the e2e is stuck again.
Is there a way to use this in e2e tests? If not, unfortunately, we'll have to change to a different captcha library.
Is Angular 9 support coming in the near future?
I updated my projects to use Angular 16.1.4 with Typescript 5.1.6.
Now I get these build errors:
Error: node_modules/angular-captcha/src/botdetect-captcha.module.d.ts:4:46 - error TS2314: Generic type 'ModuleWithProviders' requires 1 type argument(s).
Error: projects/shared-portals/src/lib/shared-portals.module.ts:66:9 - error NG6002: 'BotDetectCaptchaModule' does not appear to be an NgModule class.
66 BotDetectCaptchaModule,
~~~~~~~~~~~~~~~~~~~~~~
node_modules/angular-captcha/src/botdetect-captcha.module.d.ts:3:22
3 export declare class BotDetectCaptchaModule {
~~~~~~~~~~~~~~~~~~~~~~
This likely means that the library (angular-captcha) which declares BotDetectCaptchaModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
Am I missing something, or is angular-captcha unable to support Angular 16 + Typescript 5?
I have followed the steps in npm for setting up this package but after adding this code:
BotDetectCaptchaModule.forRoot({
captchaEndpoint: '/botdetect-java-captcha-api-path-at-server-side/botdetectcaptcha'
})
to my appModule, the app log the following error in console:
compiler.js:466 Uncaught Error: Can't resolve all parameters for CaptchaService: (?, ?, ?).
at syntaxError (compiler.js:466)
at CompileMetadataResolver._getDependenciesMetadata (compiler.js:15547)
at CompileMetadataResolver._getTypeMetadata (compiler.js:15382)
at CompileMetadataResolver._getInjectableMetadata (compiler.js:15362)
at CompileMetadataResolver.getProviderMetadata (compiler.js:15722)
at eval (compiler.js:15633)
at Array.forEach (<anonymous>)
at CompileMetadataResolver._getProvidersMetadata (compiler.js:15593)
at eval (compiler.js:15595)
at Array.forEach (<anonymous>)
I don't use systemJS so I skip the systemJS step in npm
The error:
Uncaught Error: Can't resolve all parameters for CorrectCaptchaDirective: (?, [object Object])...
It seams that the import:
import { DOCUMENT } from '@angular/platform-browser';
has changed to:
import { DOCUMENT } from '@angular/common';
It would be nice to be able to reuse this source code.
Did you consider adding a free software license?
hi,
when we started using BotDetectCaptcha in angular 16+ projectes we encountered this error, would you please consider this issue:
This likely means that the library (angular-captcha) which declares BotDetectCaptchaModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.