diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/user.ts | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/server/lib/user.ts b/server/lib/user.ts index b50b09d72..0e4007770 100644 --- a/server/lib/user.ts +++ b/server/lib/user.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as uuidv4 from 'uuid/v4' | 1 | import * as uuidv4 from 'uuid/v4' |
2 | import { ActivityPubActorType } from '../../shared/models/activitypub' | 2 | import { ActivityPubActorType } from '../../shared/models/activitypub' |
3 | import { SERVER_ACTOR_NAME } from '../initializers/constants' | 3 | import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants' |
4 | import { AccountModel } from '../models/account/account' | 4 | import { AccountModel } from '../models/account/account' |
5 | import { UserModel } from '../models/account/user' | 5 | import { UserModel } from '../models/account/user' |
6 | import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub' | 6 | import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub' |
@@ -12,6 +12,8 @@ import { UserNotificationSetting, UserNotificationSettingValue } from '../../sha | |||
12 | import { createWatchLaterPlaylist } from './video-playlist' | 12 | import { createWatchLaterPlaylist } from './video-playlist' |
13 | import { sequelizeTypescript } from '../initializers/database' | 13 | import { sequelizeTypescript } from '../initializers/database' |
14 | import { Transaction } from 'sequelize/types' | 14 | import { Transaction } from 'sequelize/types' |
15 | import { Redis } from './redis' | ||
16 | import { Emailer } from './emailer' | ||
15 | 17 | ||
16 | type ChannelNames = { name: string, displayName: string } | 18 | type ChannelNames = { name: string, displayName: string } |
17 | async function createUserAccountAndChannelAndPlaylist (parameters: { | 19 | async function createUserAccountAndChannelAndPlaylist (parameters: { |
@@ -100,12 +102,24 @@ async function createApplicationActor (applicationId: number) { | |||
100 | return accountCreated | 102 | return accountCreated |
101 | } | 103 | } |
102 | 104 | ||
105 | async function sendVerifyUserEmail (user: UserModel, isPendingEmail = false) { | ||
106 | const verificationString = await Redis.Instance.setVerifyEmailVerificationString(user.id) | ||
107 | let url = WEBSERVER.URL + '/verify-account/email?userId=' + user.id + '&verificationString=' + verificationString | ||
108 | |||
109 | if (isPendingEmail) url += '&isPendingEmail=true' | ||
110 | |||
111 | const email = isPendingEmail ? user.pendingEmail : user.email | ||
112 | |||
113 | await Emailer.Instance.addVerifyEmailJob(email, url) | ||
114 | } | ||
115 | |||
103 | // --------------------------------------------------------------------------- | 116 | // --------------------------------------------------------------------------- |
104 | 117 | ||
105 | export { | 118 | export { |
106 | createApplicationActor, | 119 | createApplicationActor, |
107 | createUserAccountAndChannelAndPlaylist, | 120 | createUserAccountAndChannelAndPlaylist, |
108 | createLocalAccountWithoutKeys | 121 | createLocalAccountWithoutKeys, |
122 | sendVerifyUserEmail | ||
109 | } | 123 | } |
110 | 124 | ||
111 | // --------------------------------------------------------------------------- | 125 | // --------------------------------------------------------------------------- |