Blame view

client/modules/recover-password.js 831 Bytes
db5aba845   Ryan Glover   miscellaneous wor...
1
2
3
  let template;
  
  let _handleRecovery = () => {
c39994410   Ryan Glover   wip converting to...
4
    let email = template.find( '[name="emailAddress"]' ).value;
0ccda7775   Ryan Glover   add support for E...
5

c39994410   Ryan Glover   wip converting to...
6
7
8
9
10
11
12
    Accounts.forgotPassword( { email: email }, ( error ) => {
      if ( error ) {
        Bert.alert( error.reason, 'warning' );
      } else {
        Bert.alert( 'Check your inbox for a reset link!', 'success' );
      }
    });
0ccda7775   Ryan Glover   add support for E...
13
  };
db5aba845   Ryan Glover   miscellaneous wor...
14
  let validation = () => {
0ccda7775   Ryan Glover   add support for E...
15
16
17
18
19
20
21
22
23
24
25
26
27
    return {
      rules: {
        emailAddress: {
          required: true,
          email: true
        }
      },
      messages: {
        emailAddress: {
          required: 'Need an email address here.',
          email: 'Is this email address legit?'
        }
      },
db5aba845   Ryan Glover   miscellaneous wor...
28
      submitHandler() { _handleRecovery(); }
0ccda7775   Ryan Glover   add support for E...
29
30
    };
  };
db5aba845   Ryan Glover   miscellaneous wor...
31
32
  let _validate = ( form ) => {
    $( form ).validate( validation() );
0ccda7775   Ryan Glover   add support for E...
33
  };
db5aba845   Ryan Glover   miscellaneous wor...
34
35
36
  export default function( options ) {
    template = options.template;
    _validate( options.form );
c39994410   Ryan Glover   wip converting to...
37
  }