Recaptcha #886
3 changed files with 9 additions and 5 deletions
|
@ -2,8 +2,12 @@ import React from "react";
|
||||||
import Link from "component/link";
|
import Link from "component/link";
|
||||||
import { CreditAmount } from "component/common";
|
import { CreditAmount } from "component/common";
|
||||||
import { Form, FormRow, Submit } from "component/form.js";
|
import { Form, FormRow, Submit } from "component/form.js";
|
||||||
|
import Recaptcha from "react-recaptcha";
|
||||||
|
|
||||||
var Recaptcha = require("react-recaptcha");
|
const sitekey =
|
||||||
|
process.env.NODE_ENV === "development"
|
||||||
|
? "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"
|
||||||
|
: "6LcWvj0UAAAAAGBAEp6-UDoe0_iSAn8IZW0GDcf0";
|
||||||
|
|
||||||
class UserEmailVerify extends React.PureComponent {
|
class UserEmailVerify extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -28,7 +32,7 @@ class UserEmailVerify extends React.PureComponent {
|
||||||
|
|
||||||
verifyCallback(response) {
|
verifyCallback(response) {
|
||||||
this.setState({
|
this.setState({
|
||||||
recaptcha: String(response).trim(),
|
recaptcha: String(response),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +58,7 @@ class UserEmailVerify extends React.PureComponent {
|
||||||
errorMessage={errorMessage}
|
errorMessage={errorMessage}
|
||||||
/>
|
/>
|
||||||
<Recaptcha
|
<Recaptcha
|
||||||
sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"
|
sitekey={sitekey}
|
||||||
verifyCallback={this.verifyCallback.bind(this)}
|
verifyCallback={this.verifyCallback.bind(this)}
|
||||||
/>
|
/>
|
||||||
{/* render help separately so it always shows */}
|
{/* render help separately so it always shows */}
|
||||||
|
|
|
@ -19,7 +19,7 @@ const contextMenu = remote.require("./main.js").contextMenu;
|
||||||
const app = require("./app");
|
const app = require("./app");
|
||||||
const load = require("@segment/load-script");
|
const load = require("@segment/load-script");
|
||||||
|
|
||||||
load("//www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit");
|
load("//www.google.com/recaptcha/api.js?render=explicit");
|
||||||
|
|
||||||
// Workaround for https://github.com/electron-userland/electron-webpack/issues/52
|
// Workaround for https://github.com/electron-userland/electron-webpack/issues/52
|
||||||
if (process.env.NODE_ENV !== "development") {
|
if (process.env.NODE_ENV !== "development") {
|
||||||
|
|
|
@ -105,7 +105,7 @@ export function doUserEmailVerify(verificationToken, recaptcha) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
const email = selectEmailToVerify(getState());
|
const email = selectEmailToVerify(getState());
|
||||||
verificationToken = verificationToken.toString().trim();
|
verificationToken = verificationToken.toString().trim();
|
||||||
recaptcha = recaptcha.toString().trim();
|
recaptcha = recaptcha.toString();
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.USER_EMAIL_VERIFY_STARTED,
|
type: types.USER_EMAIL_VERIFY_STARTED,
|
||||||
|
|
Loading…
Add table
Reference in a new issue