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