diff options
author | John Livingston <38844060+JohnXLivingston@users.noreply.github.com> | 2020-02-17 10:16:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 10:16:52 +0100 |
commit | 45f1bd72a08998c60a9dd68ff069cea9de39161c (patch) | |
tree | 79e484bd7fd38fe97c84fdb00a164534f43941e9 /client/src/app/+admin/users/user-edit/user-create.component.ts | |
parent | c5621bd23bce038671cd81149a0aa5e238558b67 (diff) | |
download | PeerTube-45f1bd72a08998c60a9dd68ff069cea9de39161c.tar.gz PeerTube-45f1bd72a08998c60a9dd68ff069cea9de39161c.tar.zst PeerTube-45f1bd72a08998c60a9dd68ff069cea9de39161c.zip |
Creating a user with an empty password will send an email to let him set his password (#2479)
* Creating a user with an empty password will send an email to let him set his password
* Consideration of Chocobozzz's comments
* Tips for optional password
* API documentation
* Fix circular imports
* Tests
Diffstat (limited to 'client/src/app/+admin/users/user-edit/user-create.component.ts')
-rw-r--r-- | client/src/app/+admin/users/user-edit/user-create.component.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts index e726ec4d7..1769c0de0 100644 --- a/client/src/app/+admin/users/user-edit/user-create.component.ts +++ b/client/src/app/+admin/users/user-edit/user-create.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router, ActivatedRoute } from '@angular/router' |
3 | import { AuthService, Notifier, ServerService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService } from '@app/core' |
4 | import { UserCreate, UserRole } from '../../../../../../shared' | 4 | import { UserCreate, UserRole } from '../../../../../../shared' |
5 | import { UserEdit } from './user-edit' | 5 | import { UserEdit } from './user-edit' |
@@ -23,6 +23,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
23 | protected configService: ConfigService, | 23 | protected configService: ConfigService, |
24 | protected auth: AuthService, | 24 | protected auth: AuthService, |
25 | private userValidatorsService: UserValidatorsService, | 25 | private userValidatorsService: UserValidatorsService, |
26 | private route: ActivatedRoute, | ||
26 | private router: Router, | 27 | private router: Router, |
27 | private notifier: Notifier, | 28 | private notifier: Notifier, |
28 | private userService: UserService, | 29 | private userService: UserService, |
@@ -45,7 +46,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
45 | this.buildForm({ | 46 | this.buildForm({ |
46 | username: this.userValidatorsService.USER_USERNAME, | 47 | username: this.userValidatorsService.USER_USERNAME, |
47 | email: this.userValidatorsService.USER_EMAIL, | 48 | email: this.userValidatorsService.USER_EMAIL, |
48 | password: this.userValidatorsService.USER_PASSWORD, | 49 | password: this.isPasswordOptional() ? this.userValidatorsService.USER_PASSWORD_OPTIONAL : this.userValidatorsService.USER_PASSWORD, |
49 | role: this.userValidatorsService.USER_ROLE, | 50 | role: this.userValidatorsService.USER_ROLE, |
50 | videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, | 51 | videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, |
51 | videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, | 52 | videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, |
@@ -78,6 +79,11 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
78 | return true | 79 | return true |
79 | } | 80 | } |
80 | 81 | ||
82 | isPasswordOptional () { | ||
83 | const serverConfig = this.route.snapshot.data.serverConfig | ||
84 | return serverConfig.email.enabled | ||
85 | } | ||
86 | |||
81 | getFormButtonTitle () { | 87 | getFormButtonTitle () { |
82 | return this.i18n('Create user') | 88 | return this.i18n('Create user') |
83 | } | 89 | } |