Require authentication to participate in chat (#4762)
* feat(chat): require authentication to participate in chat * fix: it's pretty much impossible to bypass the auth requirement, addressing review feedback anyway * feat(chat): render chat text input as disabled if chat auth is required * Commit updated API documentation --------- Co-authored-by: Owncast <owncast@owncast.online>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
var request = require('supertest');
|
||||
var bcrypt = require('bcrypt');
|
||||
var shajs = require("sha.js");
|
||||
var shajs = require('sha.js');
|
||||
|
||||
const sendAdminRequest = require('./lib/admin').sendAdminRequest;
|
||||
const failAdminRequest = require('./lib/admin').failAdminRequest;
|
||||
@@ -330,6 +330,24 @@ test('disable search indexing', async () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('set chat require authentication enabled', async () => {
|
||||
await sendAdminRequest('config/chat/requireauthentication', true);
|
||||
});
|
||||
|
||||
test('verify chat require authentication is enabled in config', async () => {
|
||||
const res = await getAdminResponse('serverconfig');
|
||||
expect(res.body.chatRequireAuthentication).toBe(true);
|
||||
});
|
||||
|
||||
test('set chat require authentication disabled', async () => {
|
||||
await sendAdminRequest('config/chat/requireauthentication', false);
|
||||
});
|
||||
|
||||
test('verify chat require authentication is disabled in config', async () => {
|
||||
const res = await getAdminResponse('serverconfig');
|
||||
expect(res.body.chatRequireAuthentication).toBe(false);
|
||||
});
|
||||
|
||||
test('change admin password', async () => {
|
||||
await sendAdminRequest('config/adminpass', newAdminPassword);
|
||||
});
|
||||
@@ -366,7 +384,7 @@ test('change admin password >72 bytes', async () => {
|
||||
test('verify admin password change (>72 bytes)', async () => {
|
||||
const res = await getAdminResponse(
|
||||
'serverconfig',
|
||||
(adminPassword = newAdminPasswordLong)
|
||||
(adminPassword = newAdminPasswordLong),
|
||||
);
|
||||
|
||||
bcrypt.compare(
|
||||
@@ -374,7 +392,7 @@ test('verify admin password change (>72 bytes)', async () => {
|
||||
res.body.adminPassword,
|
||||
function (err, result) {
|
||||
expect(result).toBe(true);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -382,7 +400,7 @@ test('reset admin password (>72)', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/adminpass',
|
||||
defaultAdminPassword,
|
||||
(adminPassword = newAdminPasswordLong)
|
||||
(adminPassword = newAdminPasswordLong),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user