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
This commit is contained in:
Josh Morel
2018-11-21 02:48:29 -05:00
committed by Chocobozzz
parent 04b8c3fba6
commit fc2ec87a8c
12 changed files with 88 additions and 3 deletions

View File

@@ -428,6 +428,14 @@ describe('Test users API validators', function () {
await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields })
})
it('Should fail with an invalid emailVerified attribute', async function () {
const fields = {
emailVerified: 'yes'
}
await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields })
})
it('Should fail with an invalid videoQuota attribute', async function () {
const fields = {
videoQuota: -90
@@ -463,6 +471,7 @@ describe('Test users API validators', function () {
it('Should succeed with the correct params', async function () {
const fields = {
email: 'email@example.com',
emailVerified: true,
videoQuota: 42,
role: UserRole.MODERATOR
}

View File

@@ -478,6 +478,7 @@ describe('Test users', function () {
userId,
accessToken,
email: 'updated2@example.com',
emailVerified: true,
videoQuota: 42,
role: UserRole.MODERATOR
})
@@ -487,6 +488,7 @@ describe('Test users', function () {
expect(user.username).to.equal('user_1')
expect(user.email).to.equal('updated2@example.com')
expect(user.emailVerified).to.be.true
expect(user.nsfwPolicy).to.equal('do_not_list')
expect(user.videoQuota).to.equal(42)
expect(user.roleLabel).to.equal('Moderator')