aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/moderation
diff options
context:
space:
mode:
authorJosh Morel <morel.josh@hotmail.com>2018-11-21 02:48:29 -0500
committerChocobozzz <me@florianbigard.com>2018-11-21 08:48:29 +0100
commitfc2ec87a8c4dcfbb91a1a62cf4c07a2a8e6a50fe (patch)
treea2cea5e299c5f1a731da99277949ea2f0bb35659 /client/src/app/shared/moderation
parent04b8c3fba614efc3827f583096c78b08cb668470 (diff)
downloadPeerTube-fc2ec87a8c4dcfbb91a1a62cf4c07a2a8e6a50fe.tar.gz
PeerTube-fc2ec87a8c4dcfbb91a1a62cf4c07a2a8e6a50fe.tar.zst
PeerTube-fc2ec87a8c4dcfbb91a1a62cf4c07a2a8e6a50fe.zip
enable email verification by admin (#1348)
* enable email verification by admin * rename/label to set email as verified to be more explicit that admin is not sending another email to confirm * add update user emailVerified check-params test * make user.model emailVerified property required
Diffstat (limited to 'client/src/app/shared/moderation')
-rw-r--r--client/src/app/shared/moderation/user-moderation-dropdown.component.ts25
1 files changed, 24 insertions, 1 deletions
diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
index 908f0b8e0..460750740 100644
--- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
+++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
@@ -4,7 +4,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
4import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' 4import { DropdownAction } from '@app/shared/buttons/action-dropdown.component'
5import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' 5import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component'
6import { UserService } from '@app/shared/users' 6import { UserService } from '@app/shared/users'
7import { AuthService, ConfirmService } from '@app/core' 7import { AuthService, ConfirmService, ServerService } from '@app/core'
8import { User, UserRight } from '../../../../../shared/models/users' 8import { User, UserRight } from '../../../../../shared/models/users'
9import { Account } from '@app/shared/account/account.model' 9import { Account } from '@app/shared/account/account.model'
10import { BlocklistService } from '@app/shared/blocklist' 10import { BlocklistService } from '@app/shared/blocklist'
@@ -32,11 +32,16 @@ export class UserModerationDropdownComponent implements OnChanges {
32 private authService: AuthService, 32 private authService: AuthService,
33 private notificationsService: NotificationsService, 33 private notificationsService: NotificationsService,
34 private confirmService: ConfirmService, 34 private confirmService: ConfirmService,
35 private serverService: ServerService,
35 private userService: UserService, 36 private userService: UserService,
36 private blocklistService: BlocklistService, 37 private blocklistService: BlocklistService,
37 private i18n: I18n 38 private i18n: I18n
38 ) { } 39 ) { }
39 40
41 get requiresEmailVerification () {
42 return this.serverService.getConfig().signup.requiresEmailVerification
43 }
44
40 ngOnChanges () { 45 ngOnChanges () {
41 this.buildActions() 46 this.buildActions()
42 } 47 }
@@ -97,6 +102,19 @@ export class UserModerationDropdownComponent implements OnChanges {
97 ) 102 )
98 } 103 }
99 104
105 setEmailAsVerified (user: User) {
106 this.userService.updateUser(user.id, { emailVerified: true }).subscribe(
107 () => {
108 this.notificationsService.success(
109 this.i18n('Success'),
110 this.i18n('User {{username}} email set as verified', { username: user.username })
111 )
112 },
113
114 err => this.notificationsService.error(this.i18n('Error'), err.message)
115 )
116 }
117
100 blockAccountByUser (account: Account) { 118 blockAccountByUser (account: Account) {
101 this.blocklistService.blockAccountByUser(account) 119 this.blocklistService.blockAccountByUser(account)
102 .subscribe( 120 .subscribe(
@@ -264,6 +282,11 @@ export class UserModerationDropdownComponent implements OnChanges {
264 label: this.i18n('Unban'), 282 label: this.i18n('Unban'),
265 handler: ({ user }: { user: User }) => this.unbanUser(user), 283 handler: ({ user }: { user: User }) => this.unbanUser(user),
266 isDisplayed: ({ user }: { user: User }) => user.blocked 284 isDisplayed: ({ user }: { user: User }) => user.blocked
285 },
286 {
287 label: this.i18n('Set Email as Verified'),
288 handler: ({ user }: { user: User }) => this.setEmailAsVerified(user),
289 isDisplayed: ({ user }: { user: User }) => this.requiresEmailVerification && !user.blocked && user.emailVerified === false
267 } 290 }
268 ]) 291 ])
269 } 292 }