aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker.ts3
-rw-r--r--server/initializers/constants.ts6
-rw-r--r--server/initializers/installer.ts1
-rw-r--r--server/initializers/migrations/0265-user-email-verified.ts24
4 files changed, 32 insertions, 2 deletions
diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts
index 916e9067e..ee02ecf48 100644
--- a/server/initializers/checker.ts
+++ b/server/initializers/checker.ts
@@ -49,7 +49,8 @@ function checkMissedConfig () {
49 'log.level', 49 'log.level',
50 'user.video_quota', 'user.video_quota_daily', 50 'user.video_quota', 'user.video_quota_daily',
51 'cache.previews.size', 'admin.email', 51 'cache.previews.size', 'admin.email',
52 'signup.enabled', 'signup.limit', 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', 52 'signup.enabled', 'signup.limit', 'signup.requires_email_verification',
53 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist',
53 'transcoding.enabled', 'transcoding.threads', 54 'transcoding.enabled', 'transcoding.threads',
54 'import.videos.http.enabled', 55 'import.videos.http.enabled',
55 'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route', 56 'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 2d9a2e670..5d93c6b82 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -15,7 +15,7 @@ let config: IConfig = require('config')
15 15
16// --------------------------------------------------------------------------- 16// ---------------------------------------------------------------------------
17 17
18const LAST_MIGRATION_VERSION = 260 18const LAST_MIGRATION_VERSION = 265
19 19
20// --------------------------------------------------------------------------- 20// ---------------------------------------------------------------------------
21 21
@@ -204,6 +204,7 @@ const CONFIG = {
204 SIGNUP: { 204 SIGNUP: {
205 get ENABLED () { return config.get<boolean>('signup.enabled') }, 205 get ENABLED () { return config.get<boolean>('signup.enabled') },
206 get LIMIT () { return config.get<number>('signup.limit') }, 206 get LIMIT () { return config.get<number>('signup.limit') },
207 get REQUIRES_EMAIL_VERIFICATION () { return config.get<boolean>('signup.requires_email_verification') },
207 FILTERS: { 208 FILTERS: {
208 CIDR: { 209 CIDR: {
209 get WHITELIST () { return config.get<string[]>('signup.filters.cidr.whitelist') }, 210 get WHITELIST () { return config.get<string[]>('signup.filters.cidr.whitelist') },
@@ -500,6 +501,8 @@ const BCRYPT_SALT_SIZE = 10
500 501
501const USER_PASSWORD_RESET_LIFETIME = 60000 * 5 // 5 minutes 502const USER_PASSWORD_RESET_LIFETIME = 60000 * 5 // 5 minutes
502 503
504const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes
505
503const NSFW_POLICY_TYPES: { [ id: string]: NSFWPolicyType } = { 506const NSFW_POLICY_TYPES: { [ id: string]: NSFWPolicyType } = {
504 DO_NOT_LIST: 'do_not_list', 507 DO_NOT_LIST: 'do_not_list',
505 BLUR: 'blur', 508 BLUR: 'blur',
@@ -661,6 +664,7 @@ export {
661 VIDEO_ABUSE_STATES, 664 VIDEO_ABUSE_STATES,
662 JOB_REQUEST_TIMEOUT, 665 JOB_REQUEST_TIMEOUT,
663 USER_PASSWORD_RESET_LIFETIME, 666 USER_PASSWORD_RESET_LIFETIME,
667 USER_EMAIL_VERIFY_LIFETIME,
664 IMAGE_MIMETYPE_EXT, 668 IMAGE_MIMETYPE_EXT,
665 SCHEDULER_INTERVALS_MS, 669 SCHEDULER_INTERVALS_MS,
666 REPEAT_JOBS, 670 REPEAT_JOBS,
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts
index d4aaec8fe..818bb04a2 100644
--- a/server/initializers/installer.ts
+++ b/server/initializers/installer.ts
@@ -122,6 +122,7 @@ async function createOAuthAdminIfNotExist () {
122 email, 122 email,
123 password, 123 password,
124 role, 124 role,
125 verified: true,
125 nsfwPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY, 126 nsfwPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY,
126 videoQuota: -1, 127 videoQuota: -1,
127 videoQuotaDaily: -1 128 videoQuotaDaily: -1
diff --git a/server/initializers/migrations/0265-user-email-verified.ts b/server/initializers/migrations/0265-user-email-verified.ts
new file mode 100644
index 000000000..59dfdad2b
--- /dev/null
+++ b/server/initializers/migrations/0265-user-email-verified.ts
@@ -0,0 +1,24 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7}): Promise<any> {
8 {
9 const data = {
10 type: Sequelize.BOOLEAN,
11 allowNull: true,
12 defaultValue: null
13 }
14
15 await utils.queryInterface.addColumn('user', 'emailVerified', data)
16 }
17
18}
19
20function down (options) {
21 throw new Error('Not implemented.')
22}
23
24export { up, down }