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