aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-07 16:59:53 +0200
committerChocobozzz <me@florianbigard.com>2019-06-07 17:05:42 +0200
commit1f20622f2b087eaf8738d60fae00a44b9c558ca3 (patch)
tree1c8554623665ca96b8a1e6f2a6bcb8c1b5a83c2e /client/src/app/shared/users
parent1a03bea0c42fa1064ce4770157b4fd2e3edd5565 (diff)
downloadPeerTube-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 'client/src/app/shared/users')
-rw-r--r--client/src/app/shared/users/user.service.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/shared/users/user.service.ts
index 20883456f..70ff9a058 100644
--- a/client/src/app/shared/users/user.service.ts
+++ b/client/src/app/shared/users/user.service.ts
@@ -136,6 +136,22 @@ export class UserService {
136 .pipe(catchError(res => this.restExtractor.handleError(res))) 136 .pipe(catchError(res => this.restExtractor.handleError(res)))
137 } 137 }
138 138
139 getNewUsername (oldDisplayName: string, newDisplayName: string, currentUsername: string) {
140 // Don't update display name, the user seems to have changed it
141 if (this.displayNameToUsername(oldDisplayName) !== currentUsername) return currentUsername
142
143 return this.displayNameToUsername(newDisplayName)
144 }
145
146 displayNameToUsername (displayName: string) {
147 if (!displayName) return ''
148
149 return displayName
150 .toLowerCase()
151 .replace(/\s/g, '_')
152 .replace(/[^a-z0-9_.]/g, '')
153 }
154
139 /* ###### Admin methods ###### */ 155 /* ###### Admin methods ###### */
140 156
141 addUser (userCreate: UserCreate) { 157 addUser (userCreate: UserCreate) {