diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-07 16:59:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-07 17:05:42 +0200 |
commit | 1f20622f2b087eaf8738d60fae00a44b9c558ca3 (patch) | |
tree | 1c8554623665ca96b8a1e6f2a6bcb8c1b5a83c2e /shared | |
parent | 1a03bea0c42fa1064ce4770157b4fd2e3edd5565 (diff) | |
download | PeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.tar.gz PeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.tar.zst PeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.zip |
Improve registration
* Add ability to set the user display name
* Use display name to guess the username/channel name
* Add explanations about what is the purpose of a username/channel name
* Add a loader at the "done" step
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/users/users.ts | 6 | ||||
-rw-r--r-- | shared/models/users/user-register.model.ts | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/shared/extra-utils/users/users.ts b/shared/extra-utils/users/users.ts index 0f2f0ae15..c09211b71 100644 --- a/shared/extra-utils/users/users.ts +++ b/shared/extra-utils/users/users.ts | |||
@@ -73,7 +73,7 @@ function registerUser (url: string, username: string, password: string, specialS | |||
73 | 73 | ||
74 | function registerUserWithChannel (options: { | 74 | function registerUserWithChannel (options: { |
75 | url: string, | 75 | url: string, |
76 | user: { username: string, password: string }, | 76 | user: { username: string, password: string, displayName?: string }, |
77 | channel: { name: string, displayName: string } | 77 | channel: { name: string, displayName: string } |
78 | }) { | 78 | }) { |
79 | const path = '/api/v1/users/register' | 79 | const path = '/api/v1/users/register' |
@@ -84,6 +84,10 @@ function registerUserWithChannel (options: { | |||
84 | channel: options.channel | 84 | channel: options.channel |
85 | } | 85 | } |
86 | 86 | ||
87 | if (options.user.displayName) { | ||
88 | Object.assign(body, { displayName: options.user.displayName }) | ||
89 | } | ||
90 | |||
87 | return makePostBodyRequest({ | 91 | return makePostBodyRequest({ |
88 | url: options.url, | 92 | url: options.url, |
89 | path, | 93 | path, |
diff --git a/shared/models/users/user-register.model.ts b/shared/models/users/user-register.model.ts index ce5c9c3d2..cf9a43a67 100644 --- a/shared/models/users/user-register.model.ts +++ b/shared/models/users/user-register.model.ts | |||
@@ -3,6 +3,8 @@ export interface UserRegister { | |||
3 | password: string | 3 | password: string |
4 | email: string | 4 | email: string |
5 | 5 | ||
6 | displayName?: string | ||
7 | |||
6 | channel?: { | 8 | channel?: { |
7 | name: string | 9 | name: string |
8 | displayName: string | 10 | displayName: string |