Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3416 | Rev 3694 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3416 Rev 3432
Línea 30... Línea 30...
30
`;
30
`;
Línea 31... Línea 31...
31
 
31
 
32
const ForgotPassword = () => {
32
const ForgotPassword = () => {
33
  const { site_key, aes } = useSelector(({ auth }) => auth);
33
  const { site_key, aes } = useSelector(({ auth }) => auth);
34
  const [forgotSent, setForgotSent] = useState(false);
34
  const [forgotSent, setForgotSent] = useState(false);
35
  const [loading, setloading] = useState(false);
35
  const [isLoading, setIsLoading] = useState(false);
36
  const [isVerified, setIsVerified] = useState(false);
36
  const [isVerified, setIsVerified] = useState(false);
37
  const reCaptchaInstance = useRef(null);
37
  const reCaptchaInstance = useRef(null);
38
  const reCaptchaToken = useRef("");
38
  const reCaptchaToken = useRef("");
Línea 64... Línea 64...
64
    reCaptchaToken.current = "";
64
    reCaptchaToken.current = "";
65
    setIsVerified(false);
65
    setIsVerified(false);
66
  };
66
  };
Línea 67... Línea 67...
67
 
67
 
68
  const onSubmitHandler = handleSubmit(async ({ email }) => {
68
  const onSubmitHandler = handleSubmit(async ({ email }) => {
69
    setloading(true);
69
    setIsLoading(true);
Línea 70... Línea 70...
70
    const formData = new FormData();
70
    const formData = new FormData();
71
 
71
 
Línea 72... Línea 72...
72
    formData.append("email", CryptoJSAesJson.encrypt(email, aes));
72
    formData.append("email", CryptoJSAesJson.encrypt(email, aes));
73
    formData.append("captcha", reCaptchaToken.current);
73
    formData.append("captcha", reCaptchaToken.current);
74
 
74
 
75
    axios
75
    axios
Línea 76... Línea 76...
76
      .post("/forgot-password", formData)
76
      .post("/forgot-password", formData)
77
      .then(({ data: response }) => {
77
      .then((response) => {
78
        const { success, data } = response;
78
        const { success, data } = response.data;
Línea 88... Línea 88...
88
      })
88
      })
89
      .catch((err) => {
89
      .catch((err) => {
90
        console.log(`Error: ${err}`);
90
        console.log(`Error: ${err}`);
91
        dispatch(addNotification({ style: "danger", msg: err.message }));
91
        dispatch(addNotification({ style: "danger", msg: err.message }));
92
      })
92
      })
93
      .finally(() => setloading(false));
93
      .finally(() => setIsLoading(false));
94
  });
94
  });
Línea 95... Línea 95...
95
 
95
 
96
  useEffect(() => {
96
  useEffect(() => {
97
    reCaptchaInstance.current?.reset();
97
    reCaptchaInstance.current?.reset();
Línea 113... Línea 113...
113
    );
113
    );
114
  }
114
  }
Línea 115... Línea 115...
115
 
115
 
116
  return (
116
  return (
117
    <Form onSubmit={onSubmitHandler}>
117
    <Form onSubmit={onSubmitHandler}>
Línea 118... Línea 118...
118
      {loading && <Spinner absolute />}
118
      {isLoading && <Spinner absolute />}
Línea 119... Línea 119...
119
 
119
 
120
      <Typography variant="h3">Olvide mi Clave</Typography>
120
      <Typography variant="h3">Olvide mi Clave</Typography>