homeflowjs 0.13.55 → 0.13.56
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
@@ -3,14 +3,34 @@ import PropTypes from 'prop-types';
|
|
3
3
|
|
4
4
|
import notify from '../../app/notify';
|
5
5
|
|
6
|
-
const ForgottenPasswordForm = ({
|
6
|
+
const ForgottenPasswordForm = ({
|
7
|
+
inputClass,
|
8
|
+
buttonClass,
|
9
|
+
buttonSpanClass,
|
10
|
+
honeypot,
|
11
|
+
honeypotClass,
|
12
|
+
}) => {
|
7
13
|
const [email, setEmail] = useState('');
|
14
|
+
const [honeypotInput, setHoneypotInput] = useState('');
|
8
15
|
const [success, setSuccess] = useState(false);
|
9
16
|
|
17
|
+
const fallbackHoneypotStyles = {
|
18
|
+
display: 'block',
|
19
|
+
width: 0,
|
20
|
+
height: 0,
|
21
|
+
padding: 0,
|
22
|
+
border: 0,
|
23
|
+
opacity: 0,
|
24
|
+
fontSize: 0,
|
25
|
+
color: 'transparent',
|
26
|
+
};
|
27
|
+
|
10
28
|
const handleSubmit = (e) => {
|
11
29
|
e.preventDefault();
|
12
30
|
|
13
31
|
const formData = new FormData();
|
32
|
+
if (honeypotInput !== '') return window.location.href = '/';
|
33
|
+
|
14
34
|
formData.append('email', email);
|
15
35
|
|
16
36
|
fetch('/reset_passwords', {
|
@@ -39,6 +59,18 @@ const ForgottenPasswordForm = ({ inputClass, buttonClass, buttonSpanClass }) =>
|
|
39
59
|
|
40
60
|
return (
|
41
61
|
<form className="forgotten-password-form" onSubmit={handleSubmit}>
|
62
|
+
{honeypot && (
|
63
|
+
<input
|
64
|
+
className={honeypotClass || null}
|
65
|
+
style={honeypotClass ? null : fallbackHoneypotStyles}
|
66
|
+
type="text"
|
67
|
+
id="body"
|
68
|
+
name="body"
|
69
|
+
value={honeypotInput}
|
70
|
+
onChange={(e) => setHoneypotInput(e.target.value)}
|
71
|
+
/>
|
72
|
+
)}
|
73
|
+
|
42
74
|
<p>Enter your email address and we'll send you a link to reset your password.</p>
|
43
75
|
|
44
76
|
<input
|
@@ -65,12 +97,16 @@ ForgottenPasswordForm.propTypes = {
|
|
65
97
|
inputClass: PropTypes.string,
|
66
98
|
buttonClass: PropTypes.string,
|
67
99
|
buttonSpanClass: PropTypes.string,
|
100
|
+
honeypot: PropTypes.bool,
|
101
|
+
honeypotClass: PropTypes.string,
|
68
102
|
};
|
69
103
|
|
70
104
|
ForgottenPasswordForm.defaultProps = {
|
71
105
|
inputClass: '',
|
72
106
|
buttonClass: '',
|
73
107
|
buttonSpanClass: '',
|
108
|
+
honeypot: false,
|
109
|
+
honeypotClass: '',
|
74
110
|
};
|
75
111
|
|
76
112
|
export default ForgottenPasswordForm;
|