|
|
|
@ -332,19 +332,27 @@ describe('Controllers', () => {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('registration interstitials', () => {
|
|
|
|
|
describe.only('registration interstitials', () => {
|
|
|
|
|
describe('email update', () => {
|
|
|
|
|
let jar;
|
|
|
|
|
let token;
|
|
|
|
|
|
|
|
|
|
it('email interstitial should still apply if empty email entered and requireEmailAddress is enabled', async () => {
|
|
|
|
|
meta.config.requireEmailAddress = 1;
|
|
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
|
jar = await helpers.registerUser({
|
|
|
|
|
username: 'testEmailReg',
|
|
|
|
|
password: 'asdasd',
|
|
|
|
|
username: utils.generateUUID().slice(0, 10),
|
|
|
|
|
password: utils.generateUUID(),
|
|
|
|
|
});
|
|
|
|
|
console.log(jar);
|
|
|
|
|
token = await helpers.getCsrfToken(jar);
|
|
|
|
|
|
|
|
|
|
meta.config.requireEmailAddress = 1;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
after(() => {
|
|
|
|
|
meta.config.requireEmailAddress = 0;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('email interstitial should still apply if empty email entered and requireEmailAddress is enabled', async () => {
|
|
|
|
|
let res = await requestAsync(`${nconf.get('url')}/register/complete`, {
|
|
|
|
|
method: 'post',
|
|
|
|
|
jar,
|
|
|
|
@ -367,7 +375,6 @@ describe('Controllers', () => {
|
|
|
|
|
json: true,
|
|
|
|
|
resolveWithFullResponse: true,
|
|
|
|
|
});
|
|
|
|
|
console.log(res.statusCode, JSON.stringify(res.body, null, 4));
|
|
|
|
|
assert.strictEqual(res.statusCode, 200);
|
|
|
|
|
assert(res.body.errors.length);
|
|
|
|
|
assert(res.body.errors.includes('[[error:invalid-email]]'));
|
|
|
|
@ -386,27 +393,6 @@ describe('Controllers', () => {
|
|
|
|
|
assert(!res.body.errors.includes('[[error:gdpr_consent_denied]]'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('registration should succeed once gdpr prompts are agreed to', async () => {
|
|
|
|
|
const res = await requestAsync(`${nconf.get('url')}/register/complete`, {
|
|
|
|
|
method: 'post',
|
|
|
|
|
jar,
|
|
|
|
|
json: true,
|
|
|
|
|
followRedirect: false,
|
|
|
|
|
simple: false,
|
|
|
|
|
resolveWithFullResponse: true,
|
|
|
|
|
headers: {
|
|
|
|
|
'x-csrf-token': token,
|
|
|
|
|
},
|
|
|
|
|
form: {
|
|
|
|
|
gdpr_agree_data: 'on',
|
|
|
|
|
gdpr_agree_email: 'on',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
assert.strictEqual(res.statusCode, 302);
|
|
|
|
|
assert.strictEqual(res.headers.location, `${nconf.get('relative_path')}/`);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should error if userData is falsy', async () => {
|
|
|
|
|
try {
|
|
|
|
|
await user.interstitials.email({ userData: null });
|
|
|
|
@ -502,6 +488,41 @@ describe('Controllers', () => {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('gdpr', () => {
|
|
|
|
|
let jar;
|
|
|
|
|
let token;
|
|
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
|
jar = await helpers.registerUser({
|
|
|
|
|
username: utils.generateUUID(),
|
|
|
|
|
password: utils.generateUUID(),
|
|
|
|
|
});
|
|
|
|
|
token = await helpers.getCsrfToken(jar);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('registration should succeed once gdpr prompts are agreed to', async () => {
|
|
|
|
|
const res = await requestAsync(`${nconf.get('url')}/register/complete`, {
|
|
|
|
|
method: 'post',
|
|
|
|
|
jar,
|
|
|
|
|
json: true,
|
|
|
|
|
followRedirect: false,
|
|
|
|
|
simple: false,
|
|
|
|
|
resolveWithFullResponse: true,
|
|
|
|
|
headers: {
|
|
|
|
|
'x-csrf-token': token,
|
|
|
|
|
},
|
|
|
|
|
form: {
|
|
|
|
|
gdpr_agree_data: 'on',
|
|
|
|
|
gdpr_agree_email: 'on',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
assert.strictEqual(res.statusCode, 302);
|
|
|
|
|
assert.strictEqual(res.headers.location, `${nconf.get('relative_path')}/`);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should load /robots.txt', (done) => {
|
|
|
|
|
request(`${nconf.get('url')}/robots.txt`, (err, res, body) => {
|
|
|
|
|
assert.ifError(err);
|
|
|
|
|