Formatting.
This commit is contained in:
parent
84e66f826b
commit
5de2b26335
|
@ -30,7 +30,7 @@ exports.save = async function(ctx) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Configs.SMTP:
|
case Configs.SMTP:
|
||||||
await email.verifyConfig(config)
|
await email.verifyConfig(config)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -13,5 +13,5 @@ exports.routes = [
|
||||||
authRoutes,
|
authRoutes,
|
||||||
appRoutes,
|
appRoutes,
|
||||||
templateRoutes,
|
templateRoutes,
|
||||||
emailRoutes
|
emailRoutes,
|
||||||
]
|
]
|
||||||
|
|
|
@ -39,14 +39,18 @@ class TestConfiguration {
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
// create a test user
|
// create a test user
|
||||||
await this._req({
|
await this._req(
|
||||||
email: "test@test.com",
|
{
|
||||||
password: "test",
|
email: "test@test.com",
|
||||||
_id: "us_uuid1",
|
password: "test",
|
||||||
builder: {
|
_id: "us_uuid1",
|
||||||
global: true,
|
builder: {
|
||||||
}
|
global: true,
|
||||||
}, null, controllers.users.save)
|
},
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
controllers.users.save
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultHeaders() {
|
defaultHeaders() {
|
||||||
|
@ -57,66 +61,84 @@ class TestConfiguration {
|
||||||
const authToken = jwt.sign(user, env.JWT_SECRET)
|
const authToken = jwt.sign(user, env.JWT_SECRET)
|
||||||
return {
|
return {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
Cookie: [
|
Cookie: [`${Cookies.Auth}=${authToken}`],
|
||||||
`${Cookies.Auth}=${authToken}`,
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteConfig(type) {
|
async deleteConfig(type) {
|
||||||
try {
|
try {
|
||||||
const cfg = await this._req(null,{
|
const cfg = await this._req(
|
||||||
type,
|
null,
|
||||||
}, controllers.config.find)
|
{
|
||||||
|
type,
|
||||||
|
},
|
||||||
|
controllers.config.find
|
||||||
|
)
|
||||||
if (cfg) {
|
if (cfg) {
|
||||||
await this._req(null, {
|
await this._req(
|
||||||
id: cfg._id,
|
null,
|
||||||
rev: cfg._rev,
|
{
|
||||||
}, controllers.config.destroy)
|
id: cfg._id,
|
||||||
|
rev: cfg._rev,
|
||||||
|
},
|
||||||
|
controllers.config.destroy
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveSettingsConfig() {
|
async saveSettingsConfig() {
|
||||||
await this.deleteConfig(Configs.SETTINGS)
|
await this.deleteConfig(Configs.SETTINGS)
|
||||||
await this._req({
|
await this._req(
|
||||||
type: Configs.SETTINGS,
|
{
|
||||||
config: {
|
type: Configs.SETTINGS,
|
||||||
platformUrl: "http://localhost:10000",
|
config: {
|
||||||
logoUrl: LOGO_URL,
|
platformUrl: "http://localhost:10000",
|
||||||
company: "Budibase",
|
logoUrl: LOGO_URL,
|
||||||
}
|
company: "Budibase",
|
||||||
}, null, controllers.config.save)
|
},
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
controllers.config.save
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveSmtpConfig() {
|
async saveSmtpConfig() {
|
||||||
await this.deleteConfig(Configs.SMTP)
|
await this.deleteConfig(Configs.SMTP)
|
||||||
await this._req({
|
await this._req(
|
||||||
type: Configs.SMTP,
|
{
|
||||||
config: {
|
type: Configs.SMTP,
|
||||||
port: 12345,
|
config: {
|
||||||
host: "smtptesthost.com",
|
port: 12345,
|
||||||
from: "testfrom@test.com",
|
host: "smtptesthost.com",
|
||||||
subject: "Hello!",
|
from: "testfrom@test.com",
|
||||||
}
|
subject: "Hello!",
|
||||||
}, null, controllers.config.save)
|
},
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
controllers.config.save
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveEtherealSmtpConfig() {
|
async saveEtherealSmtpConfig() {
|
||||||
await this.deleteConfig(Configs.SMTP)
|
await this.deleteConfig(Configs.SMTP)
|
||||||
await this._req({
|
await this._req(
|
||||||
type: Configs.SMTP,
|
{
|
||||||
config: {
|
type: Configs.SMTP,
|
||||||
port: 587,
|
config: {
|
||||||
host: "smtp.ethereal.email",
|
port: 587,
|
||||||
secure: false,
|
host: "smtp.ethereal.email",
|
||||||
auth: {
|
secure: false,
|
||||||
user: "don.bahringer@ethereal.email",
|
auth: {
|
||||||
pass: "yCKSH8rWyUPbnhGYk9",
|
user: "don.bahringer@ethereal.email",
|
||||||
|
pass: "yCKSH8rWyUPbnhGYk9",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}, null, controllers.config.save)
|
null,
|
||||||
|
controllers.config.save
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = TestConfiguration
|
module.exports = TestConfiguration
|
||||||
|
|
|
@ -17,10 +17,10 @@ exports.EmailTemplates = {
|
||||||
join(__dirname, "invitation.hbs")
|
join(__dirname, "invitation.hbs")
|
||||||
),
|
),
|
||||||
[EmailTemplatePurpose.BASE]: readStaticFile(join(__dirname, "base.hbs")),
|
[EmailTemplatePurpose.BASE]: readStaticFile(join(__dirname, "base.hbs")),
|
||||||
[EmailTemplatePurpose.STYLES]: readStaticFile(
|
[EmailTemplatePurpose.STYLES]: readStaticFile(join(__dirname, "style.hbs")),
|
||||||
join(__dirname, "style.hbs")
|
[EmailTemplatePurpose.WELCOME]: readStaticFile(
|
||||||
|
join(__dirname, "welcome.hbs")
|
||||||
),
|
),
|
||||||
[EmailTemplatePurpose.WELCOME]: readStaticFile(join(__dirname, "welcome.hbs")),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.addBaseTemplates = (templates, type = null) => {
|
exports.addBaseTemplates = (templates, type = null) => {
|
||||||
|
|
|
@ -28,7 +28,8 @@ exports.getSettingsTemplateContext = async () => {
|
||||||
),
|
),
|
||||||
[TemplateBindings.RESET_URL]: checkSlashesInUrl(`${URL}/reset`),
|
[TemplateBindings.RESET_URL]: checkSlashesInUrl(`${URL}/reset`),
|
||||||
[TemplateBindings.COMPANY]: settings.company || BASE_COMPANY,
|
[TemplateBindings.COMPANY]: settings.company || BASE_COMPANY,
|
||||||
[TemplateBindings.DOCS_URL]: settings.docsUrl || "https://docs.budibase.com/",
|
[TemplateBindings.DOCS_URL]:
|
||||||
|
settings.docsUrl || "https://docs.budibase.com/",
|
||||||
[TemplateBindings.LOGIN_URL]: checkSlashesInUrl(`${URL}/login`),
|
[TemplateBindings.LOGIN_URL]: checkSlashesInUrl(`${URL}/login`),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue