|
|
@ -1,9 +1,12 @@ |
|
|
|
import assert from 'assert'; |
|
|
|
import assert from 'assert'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { REP_UUID } from '../../consts'; |
|
|
|
|
|
|
|
|
|
|
|
import { sanitize } from '../../sanitize'; |
|
|
|
import { sanitize } from '../../sanitize'; |
|
|
|
|
|
|
|
|
|
|
|
export const getMailServerRequestBody = ( |
|
|
|
export const getMailServerRequestBody = ( |
|
|
|
body: Partial<MailServerRequestBody>, |
|
|
|
body: Partial<MailServerRequestBody>, |
|
|
|
|
|
|
|
uuid?: string, |
|
|
|
): MailServerRequestBody => { |
|
|
|
): MailServerRequestBody => { |
|
|
|
const { |
|
|
|
const { |
|
|
|
address: rAddress, |
|
|
|
address: rAddress, |
|
|
@ -25,6 +28,10 @@ export const getMailServerRequestBody = ( |
|
|
|
const security = sanitize(rSecurity, 'string', { fallback: 'none' }); |
|
|
|
const security = sanitize(rSecurity, 'string', { fallback: 'none' }); |
|
|
|
const username = sanitize(rUsername, 'string'); |
|
|
|
const username = sanitize(rUsername, 'string'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uuid) { |
|
|
|
|
|
|
|
assert(REP_UUID.test(uuid), `Expected valid UUIDv4; got [${uuid}]`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assert.ok(address.length, `Expected address; got [${address}]`); |
|
|
|
assert.ok(address.length, `Expected address; got [${address}]`); |
|
|
|
|
|
|
|
|
|
|
|
assert( |
|
|
|
assert( |
|
|
|