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