-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathaccounts_config.js
More file actions
77 lines (72 loc) · 1.8 KB
/
accounts_config.js
File metadata and controls
77 lines (72 loc) · 1.8 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { AccountsTemplates } from 'meteor/useraccounts:core';
// User accounts guide
// https://github.com/meteor-useraccounts/core/blob/master/Guide.md
AccountsTemplates.configure({
/* Route configuration */
defaultLayout: 'masterLayout',
defaultContentRegion: 'main',
/* Behavior */
confirmPassword: true,
enablePasswordChange: true,
forbidClientAccountCreation: false,
overrideLoginErrors: true,
lowercaseUsername: false,
sendVerificationEmail: true,
/* Appearance */
showAddRemoveServices: true,
showForgotPasswordLink: true,
showLabels: true,
showPlaceholders: true,
showResendVerificationEmailLink: true,
/* Client-side validation */
continuousValidation: false,
negativeFeedback: false,
negativeValidation: true,
positiveValidation: false,
positiveFeedback: true,
showValidating: true,
});
// rearranging the fields on Sign-Up, so that username comes first.
const passwordField = AccountsTemplates.removeField('password');
AccountsTemplates.removeField('email');
AccountsTemplates.addFields([
{
_id: 'username',
type: 'text',
displayName: 'username',
required: true,
minLength: 5,
},
{
_id: 'email',
type: 'email',
required: true,
displayName: 'email',
re: /.+@(.+){2,}\.(.+){2,}/,
errStr: 'Invalid email',
},
{
_id: 'username_and_email',
type: 'text',
required: true,
displayName: 'Login',
placeholder: 'Username or Email',
},
passwordField,
]);
// Sign in
AccountsTemplates.configureRoute('signIn', {
layoutType: 'blaze',
name: 'signIn',
path: '/sign-in',
layoutTemplate: 'masterLayout',
contentRegion: 'main',
});
// Sign up
AccountsTemplates.configureRoute('signUp', {
layoutType: 'blaze',
name: 'signUp',
path: '/sign-up',
layoutTemplate: 'masterLayout',
contentRegion: 'main',
});