mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Multi step registration
This commit is contained in:
@@ -70,6 +70,12 @@ const usersRegisterValidator = [
|
||||
.end()
|
||||
}
|
||||
|
||||
if (body.channel.name === body.username) {
|
||||
return res.status(400)
|
||||
.send({ error: 'Channel name cannot be the same than user username.' })
|
||||
.end()
|
||||
}
|
||||
|
||||
const existing = await ActorModel.loadLocalByName(body.channel.name)
|
||||
if (existing) {
|
||||
return res.status(409)
|
||||
|
||||
@@ -737,6 +737,13 @@ describe('Test users API validators', function () {
|
||||
await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
|
||||
})
|
||||
|
||||
it('Should fail with a channel name that is the same than user username', async function () {
|
||||
const source = { username: 'super_user', channel: { name: 'super_user', displayName: 'display name' } }
|
||||
const fields = immutableAssign(baseCorrectParams, source)
|
||||
|
||||
await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
|
||||
})
|
||||
|
||||
it('Should fail with an existing channel', async function () {
|
||||
const videoChannelAttributesArg = { name: 'existing_channel', displayName: 'hello', description: 'super description' }
|
||||
await addVideoChannel(server.url, server.accessToken, videoChannelAttributesArg)
|
||||
|
||||
Reference in New Issue
Block a user