homeflowjs 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -270,8 +270,13 @@ export default class DraggableMap {
|
|
270
270
|
}
|
271
271
|
|
272
272
|
generateMap(map_options) {
|
273
|
-
const zoomMax = Homeflow.get('custom_max_zoom') !== null
|
274
|
-
|
273
|
+
const zoomMax = (Homeflow.get('custom_max_zoom') !== null && Homeflow.get('custom_max_zoom') !== undefined)
|
274
|
+
? Homeflow.get('custom_max_zoom')
|
275
|
+
: 16;
|
276
|
+
const zoomMin = (Homeflow.get('custom_min_zoom') !== null && Homeflow.get('custom_min_zoom') !== undefined)
|
277
|
+
? Homeflow.get('custom_min_zoom')
|
278
|
+
: 6;
|
279
|
+
|
275
280
|
const zoomPosition = Homeflow.get('custom_map_zoom_location') ? Homeflow.get('custom_map_zoom_location') : '';
|
276
281
|
|
277
282
|
if (map_options == null) {
|
@@ -49,8 +49,12 @@ export default class DrawableMap extends DraggableMap {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
generateMap(map_options) {
|
52
|
-
const zoomMax = Homeflow.get('custom_max_zoom')
|
53
|
-
|
52
|
+
const zoomMax = (Homeflow.get('custom_max_zoom') !== null && Homeflow.get('custom_max_zoom') !== undefined)
|
53
|
+
? Homeflow.get('custom_max_zoom')
|
54
|
+
: 16;
|
55
|
+
const zoomMin = (Homeflow.get('custom_min_zoom') !== null && Homeflow.get('custom_min_zoom') !== undefined)
|
56
|
+
? Homeflow.get('custom_min_zoom')
|
57
|
+
: 6;
|
54
58
|
const drawLocation = Homeflow.get('custom_map_draw_location') ? Homeflow.get('custom_map_draw_location') : 'bottomleft';
|
55
59
|
|
56
60
|
map_options = {
|
@@ -1,6 +1,8 @@
|
|
1
|
-
import React, { useState } from 'react';
|
1
|
+
import React, { useCallback, useState, useRef, useEffect } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
|
4
|
+
import { useRecaptcha } from '../../hooks';
|
5
|
+
|
4
6
|
import notify from '../../app/notify';
|
5
7
|
|
6
8
|
const ForgottenPasswordForm = ({
|
@@ -10,8 +12,8 @@ const ForgottenPasswordForm = ({
|
|
10
12
|
honeypot,
|
11
13
|
honeypotClass,
|
12
14
|
}) => {
|
15
|
+
const formRef = useRef(null);
|
13
16
|
const [email, setEmail] = useState('');
|
14
|
-
const [honeypotInput, setHoneypotInput] = useState('');
|
15
17
|
const [success, setSuccess] = useState(false);
|
16
18
|
|
17
19
|
const fallbackHoneypotStyles = {
|
@@ -25,13 +27,13 @@ const ForgottenPasswordForm = ({
|
|
25
27
|
color: 'transparent',
|
26
28
|
};
|
27
29
|
|
28
|
-
const
|
29
|
-
|
30
|
-
|
31
|
-
const formData = new FormData();
|
32
|
-
if (honeypotInput !== '') return window.location.href = '/';
|
30
|
+
const onRecaptchaSubmit = useCallback((recaptchaData) => {
|
31
|
+
const formData = new FormData(formRef.current);
|
32
|
+
const honeypot = formData.get("body");
|
33
33
|
|
34
|
-
|
34
|
+
if (honeypot && honeypot !== '') {
|
35
|
+
return window.location.href = '/';
|
36
|
+
}
|
35
37
|
|
36
38
|
fetch('/reset_passwords', {
|
37
39
|
method: 'POST',
|
@@ -49,7 +51,28 @@ const ForgottenPasswordForm = ({
|
|
49
51
|
{ duration: 8000 },
|
50
52
|
);
|
51
53
|
});
|
52
|
-
};
|
54
|
+
}, []);
|
55
|
+
|
56
|
+
const { onRecaptchaRender, onResetRecaptcha } = useRecaptcha({
|
57
|
+
formID: 'reset-pwd',
|
58
|
+
formRef,
|
59
|
+
onRecaptchaSubmit,
|
60
|
+
shouldKickGAEvent: false,
|
61
|
+
});
|
62
|
+
|
63
|
+
useEffect(() => {
|
64
|
+
if (success) {
|
65
|
+
onResetRecaptcha()
|
66
|
+
}
|
67
|
+
}, [success])
|
68
|
+
|
69
|
+
const onFormSubmit = (e) => {
|
70
|
+
e.preventDefault();
|
71
|
+
|
72
|
+
if (formRef.current.checkValidity()) {
|
73
|
+
onRecaptchaRender();
|
74
|
+
}
|
75
|
+
}
|
53
76
|
|
54
77
|
if (success) {
|
55
78
|
return (
|
@@ -58,7 +81,11 @@ const ForgottenPasswordForm = ({
|
|
58
81
|
}
|
59
82
|
|
60
83
|
return (
|
61
|
-
<form
|
84
|
+
<form
|
85
|
+
ref={formRef}
|
86
|
+
className="forgotten-password-form"
|
87
|
+
onSubmit={onFormSubmit}
|
88
|
+
>
|
62
89
|
{honeypot && (
|
63
90
|
<input
|
64
91
|
className={honeypotClass || null}
|
@@ -66,8 +93,6 @@ const ForgottenPasswordForm = ({
|
|
66
93
|
type="text"
|
67
94
|
id="body"
|
68
95
|
name="body"
|
69
|
-
value={honeypotInput}
|
70
|
-
onChange={(e) => setHoneypotInput(e.target.value)}
|
71
96
|
/>
|
72
97
|
)}
|
73
98
|
|