recover-password.js
845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { getInputValue } from './get-input-value';
let component;
const _handleRecovery = () => {
Accounts.forgotPassword({
email: getInputValue( component, 'emailAddress', true )
}, ( error ) => {
if ( error ) {
Bert.alert( error.reason, 'warning' );
} else {
Bert.alert( 'Check your inbox for a reset link!', 'success' );
}
});
};
const _validate = () => {
$( component.refs.recoverPassword ).validate({
rules: {
emailAddress: {
required: true,
email: true
}
},
messages: {
emailAddress: {
required: 'Need an email address here.',
email: 'Is this email address legit?'
}
},
submitHandler() { _handleRecovery(); }
});
};
export const handleRecoverPassword = ( options ) => {
component = options.component;
_validate();
};