diff options
author | Josh Morel <morel.josh@hotmail.com> | 2018-11-21 02:48:29 -0500 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-11-21 08:48:29 +0100 |
commit | fc2ec87a8c4dcfbb91a1a62cf4c07a2a8e6a50fe (patch) | |
tree | a2cea5e299c5f1a731da99277949ea2f0bb35659 /client/src/app/+admin | |
parent | 04b8c3fba614efc3827f583096c78b08cb668470 (diff) | |
download | PeerTube-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/+admin')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.html | 12 | ||||
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 26 |
2 files changed, 36 insertions, 2 deletions
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 5684004a5..556ab3c5d 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html | |||
@@ -65,7 +65,17 @@ | |||
65 | <span i18n *ngIf="user.blocked" class="banned-info">(banned)</span> | 65 | <span i18n *ngIf="user.blocked" class="banned-info">(banned)</span> |
66 | </a> | 66 | </a> |
67 | </td> | 67 | </td> |
68 | <td>{{ user.email }}</td> | 68 | <td *ngIf="!requiresEmailVerification || user.blocked; else emailWithVerificationStatus">{{ user.email }}</td> |
69 | <ng-template #emailWithVerificationStatus> | ||
70 | <td *ngIf="user.emailVerified === false; else emailVerifiedNotFalse" i18n-title title="User's email must be verified to login"> | ||
71 | <em>? {{ user.email }}</em> | ||
72 | </td> | ||
73 | <ng-template #emailVerifiedNotFalse> | ||
74 | <td i18n-title title="User's email is verified / User can login without email verification"> | ||
75 | ✓ {{ user.email }} | ||
76 | </td> | ||
77 | </ng-template> | ||
78 | </ng-template> | ||
69 | <td>{{ user.videoQuotaUsed }} / {{ user.videoQuota }}</td> | 79 | <td>{{ user.videoQuotaUsed }} / {{ user.videoQuota }}</td> |
70 | <td>{{ user.roleLabel }}</td> | 80 | <td>{{ user.roleLabel }}</td> |
71 | <td>{{ user.createdAt }}</td> | 81 | <td>{{ user.createdAt }}</td> |
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 31e783622..fb085c133 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { NotificationsService } from 'angular2-notifications' |
3 | import { SortMeta } from 'primeng/components/common/sortmeta' | 3 | import { SortMeta } from 'primeng/components/common/sortmeta' |
4 | import { ConfirmService } from '../../../core' | 4 | import { ConfirmService, ServerService } from '../../../core' |
5 | import { RestPagination, RestTable, UserService } from '../../../shared' | 5 | import { RestPagination, RestTable, UserService } from '../../../shared' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { User } from '../../../../../../shared' | 7 | import { User } from '../../../../../../shared' |
@@ -28,12 +28,17 @@ export class UserListComponent extends RestTable implements OnInit { | |||
28 | constructor ( | 28 | constructor ( |
29 | private notificationsService: NotificationsService, | 29 | private notificationsService: NotificationsService, |
30 | private confirmService: ConfirmService, | 30 | private confirmService: ConfirmService, |
31 | private serverService: ServerService, | ||
31 | private userService: UserService, | 32 | private userService: UserService, |
32 | private i18n: I18n | 33 | private i18n: I18n |
33 | ) { | 34 | ) { |
34 | super() | 35 | super() |
35 | } | 36 | } |
36 | 37 | ||
38 | get requiresEmailVerification () { | ||
39 | return this.serverService.getConfig().signup.requiresEmailVerification | ||
40 | } | ||
41 | |||
37 | ngOnInit () { | 42 | ngOnInit () { |
38 | this.initialize() | 43 | this.initialize() |
39 | 44 | ||
@@ -51,6 +56,11 @@ export class UserListComponent extends RestTable implements OnInit { | |||
51 | label: this.i18n('Unban'), | 56 | label: this.i18n('Unban'), |
52 | handler: users => this.unbanUsers(users), | 57 | handler: users => this.unbanUsers(users), |
53 | isDisplayed: users => users.every(u => u.blocked === true) | 58 | isDisplayed: users => users.every(u => u.blocked === true) |
59 | }, | ||
60 | { | ||
61 | label: this.i18n('Set Email as Verified'), | ||
62 | handler: users => this.setEmailsAsVerified(users), | ||
63 | isDisplayed: users => this.requiresEmailVerification && users.every(u => !u.blocked && u.emailVerified === false) | ||
54 | } | 64 | } |
55 | ] | 65 | ] |
56 | } | 66 | } |
@@ -114,6 +124,20 @@ export class UserListComponent extends RestTable implements OnInit { | |||
114 | ) | 124 | ) |
115 | } | 125 | } |
116 | 126 | ||
127 | async setEmailsAsVerified (users: User[]) { | ||
128 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( | ||
129 | () => { | ||
130 | this.notificationsService.success( | ||
131 | this.i18n('Success'), | ||
132 | this.i18n('{{num}} users email set as verified.', { num: users.length }) | ||
133 | ) | ||
134 | this.loadData() | ||
135 | }, | ||
136 | |||
137 | err => this.notificationsService.error(this.i18n('Error'), err.message) | ||
138 | ) | ||
139 | } | ||
140 | |||
117 | isInSelectionMode () { | 141 | isInSelectionMode () { |
118 | return this.selectedUsers.length !== 0 | 142 | return this.selectedUsers.length !== 0 |
119 | } | 143 | } |