summaryrefslogtreecommitdiffstats
path: root/config/accounts.js
blob: 4964adee97cd54a5a836835ed785087171dd358f (plain)
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
39
40
41
42
43
44
const passwordField = AccountsTemplates.removeField('password');
const emailField = AccountsTemplates.removeField('email');

AccountsTemplates.addFields([
  {
    _id: 'username',
    type: 'text',
    displayName: 'username',
    required: true,
    minLength: 2,
  },
  emailField,
  passwordField,
  {
    _id: 'invitationcode',
    type: 'text',
    displayName: 'Invitation Code',
    required: false,
    minLength: 6,
    template: 'invitationCode',
  },
]);

AccountsTemplates.configure({
  defaultLayout: 'userFormsLayout',
  defaultContentRegion: 'content',
  confirmPassword: false,
  enablePasswordChange: false,
  sendVerificationEmail: false,
  showForgotPasswordLink: false,
  hideSignUpLink: true,
  onLogoutHook() {
    const homePage = 'home';
    if (FlowRouter.getRouteName() === homePage) {
      FlowRouter.reload();
    } else {
      FlowRouter.go(homePage);
    }
  },
});

[
  'signIn',
].forEach(routeName => AccountsTemplates.configureRoute(routeName));