Site invite module: email-check code mail for Video App Income's network gate (/api/partner/invite/code: fixed wording, no links, requested = transactional, 5 an hour per address, 2,000 a day; typo and throwaway domains refused); mailer.send opts.fromName = the site's name on the same authenticated address; chatbot answer extended (Marty 2026-11-21: every Video App Income member must be a network member, as frictionless as possible)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -112,5 +112,19 @@ const send = (items, x) => SI.handle('send', Object.assign({ rid: 'rid-' + Math.
|
||||
ok(r.results[0].status === 'sent before' && sent.length === n, 'after a restart the once-ever rule still holds');
|
||||
const v = await SI.adminView(); ok(v.on && v.recent.length > 20 && !/@/.test(JSON.stringify(v)), 'the admin view lists invites by username only');
|
||||
}
|
||||
// ---- the email-check code mail (a site's network gate) ----
|
||||
{
|
||||
const n = sent.length; let r = await SI.handle('code', { site: 'videoappincome', email: 'New.Person@Mail.test', code: '482913' });
|
||||
const m = sent[sent.length - 1];
|
||||
ok(r.ok && sent.length === n + 1 && m[0] === 'new.person@mail.test' && m[1] === '482913 is your Video App Income code' && m[2].startsWith('Your code is: 482913') && !/https?:/.test(m[2]), 'the code mail goes out with the code, the site name and no links', m && m.slice(0, 3));
|
||||
ok(m[4] && m[4].transactional === true && m[4].fromName === 'Video App Income', 'it is sent as a requested (transactional) mail under the site name');
|
||||
ok((await SI.handle('code', { site: 'videoappincome', email: 'not an email', code: '111111' })).code === 'email', 'a bad address is refused');
|
||||
ok((await SI.handle('code', { site: 'videoappincome', email: 'a@mail.test', code: '12ab' })).code === 'email', 'a code that is not six digits is refused');
|
||||
ok((await SI.handle('code', { site: 'videoappincome', email: 'x@mailinator.com', code: '111111' })).code === 'email', 'a throwaway address is refused');
|
||||
ok((await SI.handle('code', { site: 'videoappincome', email: 'flagged@mail.test', code: '111111' })).code === 'email', 'a suspended or flagged address is refused');
|
||||
ok((await SI.handle('code', { site: 'nosuchsite', email: 'a@mail.test', code: '111111' })).code === 'site', 'an unknown site is refused');
|
||||
for (let i = 0; i < 4; i++) await SI.handle('code', { site: 'videoappincome', email: 'new.person@mail.test', code: '482913' });
|
||||
r = await SI.handle('code', { site: 'videoappincome', email: 'new.person@mail.test', code: '482913' }); ok(r.code === 'limit', 'the sixth code to one address in an hour is refused', r);
|
||||
}
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
console.log('\n' + passes + ' passed, ' + fails + ' failed'); process.exit(fails ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user