aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account
diff options
context:
space:
mode:
authorJosh Morel <morel.josh@hotmail.com>2018-08-31 03:18:19 -0400
committerChocobozzz <me@florianbigard.com>2018-08-31 09:18:19 +0200
commitd9eaee3939bf2e93e5d775d32bce77842201faba (patch)
treec115acb3611986b98f51b3addf29ebe66f63ee7f /server/models/account
parent04291e1ba44032165388758e993d385a10c1c5a1 (diff)
downloadPeerTube-d9eaee3939bf2e93e5d775d32bce77842201faba.tar.gz
PeerTube-d9eaee3939bf2e93e5d775d32bce77842201faba.tar.zst
PeerTube-d9eaee3939bf2e93e5d775d32bce77842201faba.zip
add user account email verificiation (#977)
* add user account email verificiation includes server and client code to: * enable verificationRequired via custom config * send verification email with registration * ask for verification email * verify via email * prevent login if not verified and required * conditional client links to ask for new verification email * allow login for verified=null these are users created when verification not required should still be able to login when verification is enabled * refactor email verifcation pr * change naming from verified to emailVerified * change naming from askVerifyEmail to askSendVerifyEmail * undo unrelated automatic prettier formatting on api/config * use redirectService for home * remove redundant success notification on email verified * revert test.yaml smpt host
Diffstat (limited to 'server/models/account')
-rw-r--r--server/models/account/user.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index bae683b12..89265774b 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -24,6 +24,7 @@ import {
24 isUserBlockedReasonValid, 24 isUserBlockedReasonValid,
25 isUserBlockedValid, 25 isUserBlockedValid,
26 isUserNSFWPolicyValid, 26 isUserNSFWPolicyValid,
27 isUserEmailVerifiedValid,
27 isUserPasswordValid, 28 isUserPasswordValid,
28 isUserRoleValid, 29 isUserRoleValid,
29 isUserUsernameValid, 30 isUserUsernameValid,
@@ -92,6 +93,12 @@ export class UserModel extends Model<UserModel> {
92 @Column(DataType.STRING(400)) 93 @Column(DataType.STRING(400))
93 email: string 94 email: string
94 95
96 @AllowNull(true)
97 @Default(null)
98 @Is('UserEmailVerified', value => throwIfNotValid(value, isUserEmailVerifiedValid, 'email verified boolean'))
99 @Column
100 emailVerified: boolean
101
95 @AllowNull(false) 102 @AllowNull(false)
96 @Is('UserNSFWPolicy', value => throwIfNotValid(value, isUserNSFWPolicyValid, 'NSFW policy')) 103 @Is('UserNSFWPolicy', value => throwIfNotValid(value, isUserNSFWPolicyValid, 'NSFW policy'))
97 @Column(DataType.ENUM(values(NSFW_POLICY_TYPES))) 104 @Column(DataType.ENUM(values(NSFW_POLICY_TYPES)))
@@ -304,6 +311,7 @@ export class UserModel extends Model<UserModel> {
304 id: this.id, 311 id: this.id,
305 username: this.username, 312 username: this.username,
306 email: this.email, 313 email: this.email,
314 emailVerified: this.emailVerified,
307 nsfwPolicy: this.nsfwPolicy, 315 nsfwPolicy: this.nsfwPolicy,
308 autoPlayVideo: this.autoPlayVideo, 316 autoPlayVideo: this.autoPlayVideo,
309 role: this.role, 317 role: this.role,