Implementing recaptcha in an Ionic app

0

I tried to use all the plugins that I found of verification (captcha) within my application. I'm using the Ionic framework. I would like to know if there is a plugin that works inside the html code in that case.

Some of which I tried to implement used the tag and I got a console error warning that this tag did not exist, even including everything the documentation requested.

    
asked by anonymous 13.07.2017 / 20:07

1 answer

2

Assuming this is your question:

  

I would like to know if there is a plugin that works inside the html code in this case.

Use the ng-recaptcha component plugin for Angular 2+. Works perfectly on Ionic.

Add the module to your app.module.ts (or similar) file:

import { RecaptchaModule } from 'ng-recaptcha';
import { BrowserModule }  from '@angular/platform-browser';
import { MyApp } from './app.component.ts';

@NgModule({
  bootstrap: [MyApp],
  declarations: [MyApp],
  imports: [
    BrowserModule,
    RecaptchaModule.forRoot(), //importante
  ],
})
export class MyAppModule { }

And then, in your html templates, declare it as follows:

import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  template: '<re-captcha (onResolve)="resolved($event)" siteKey="CHAVE_DO_SEU_SITE"></re-captcha>',
}) 
export class MyApp {
  onResolve(captcha : string) {
    console.log('Token captcha ${captcha}:');
  }
}

Where CHAVE_DO_SEU_SITE is obtained by registering on the Google website reCAPTCHA .

    
12.09.2017 / 16:16