File

src/app/modules/shared/services/recaptcha/recaptcha.service.ts

Index

Properties
Methods

Constructor

constructor(http: HttpClient, config: ConfigService)
Parameters :
Name Type Optional
http HttpClient No
config ConfigService No

Methods

validateRecaptcha
validateRecaptcha(recaptchaToken: string)

Validates recaptcha token

Parameters :
Name Type Optional Description
recaptchaToken string No

: string token generated by resolving recaptcha

Returns : any

Properties

Public config
Type : ConfigService
Public http
Type : HttpClient
import {Injectable} from '@angular/core';
import {HttpOptions} from '@sunbird/shared';
import {HttpClient} from '@angular/common/http';
import {ConfigService} from '../config/config.service';


@Injectable({
  providedIn: 'root'
})
export class RecaptchaService {

  constructor(public http: HttpClient, public config: ConfigService) {
    this.http = http;
  }

  /**
   * Validates recaptcha token
   * @param recaptchaToken : string token generated by resolving recaptcha
   */
  validateRecaptcha(recaptchaToken: string) {
    const options: HttpOptions = {headers: {'Content-Type': 'application/json'}};
    return this.http.post(this.config.urlConFig.URLS.RECAPTCHA.VALIDATE + '?captchaResponse=' + recaptchaToken, options);
  }
}

results matching ""

    No results matching ""