Formatting.
This commit is contained in:
parent
2ea05c44b4
commit
5230dcd3ac
|
@ -1,5 +1,12 @@
|
||||||
<script>
|
<script>
|
||||||
import { Body, Menu, MenuItem, Detail, MenuSection, DetailSummary } from "@budibase/bbui"
|
import {
|
||||||
|
Body,
|
||||||
|
Menu,
|
||||||
|
MenuItem,
|
||||||
|
Detail,
|
||||||
|
MenuSection,
|
||||||
|
DetailSummary,
|
||||||
|
} from "@budibase/bbui"
|
||||||
|
|
||||||
export let bindings
|
export let bindings
|
||||||
export let onBindingClick = () => {}
|
export let onBindingClick = () => {}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { url } from "@roxi/routify"
|
import { url } from "@roxi/routify"
|
||||||
import {
|
import { Link } from "@budibase/bbui"
|
||||||
Link,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
import { roles } from "stores/backend"
|
import { roles } from "stores/backend"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
|
|
|
@ -101,7 +101,8 @@
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
</div></Tab
|
||||||
|
>
|
||||||
<Tab title="Preview">
|
<Tab title="Preview">
|
||||||
<div class="preview" transition:fade>
|
<div class="preview" transition:fade>
|
||||||
{@html selectedTemplate.contents}
|
{@html selectedTemplate.contents}
|
||||||
|
@ -136,5 +137,4 @@
|
||||||
margin-bottom: var(--spacing-xl);
|
margin-bottom: var(--spacing-xl);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
const templateSchema = {
|
const templateSchema = {
|
||||||
purpose: {
|
purpose: {
|
||||||
displayName: "Email",
|
displayName: "Email",
|
||||||
editable: false
|
editable: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,11 @@ exports.reset = async ctx => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const user = await getGlobalUserByEmail(email)
|
const user = await getGlobalUserByEmail(email)
|
||||||
await sendEmail(email, EmailTemplatePurpose.PASSWORD_RECOVERY, { user, subject: "{{ company }} platform password reset" })
|
await sendEmail(email, EmailTemplatePurpose.PASSWORD_RECOVERY, {
|
||||||
|
user,
|
||||||
|
subject: "{{ company }} platform password reset",
|
||||||
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// don't throw any kind of error to the user, this might give away something
|
// don't throw any kind of error to the user, this might give away something
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,27 @@ const authPkg = require("@budibase/auth")
|
||||||
const GLOBAL_DB = authPkg.StaticDatabases.GLOBAL.name
|
const GLOBAL_DB = authPkg.StaticDatabases.GLOBAL.name
|
||||||
|
|
||||||
exports.sendEmail = async ctx => {
|
exports.sendEmail = async ctx => {
|
||||||
const { groupId, email, userId, purpose, contents, from, subject } = ctx.request.body
|
const {
|
||||||
|
groupId,
|
||||||
|
email,
|
||||||
|
userId,
|
||||||
|
purpose,
|
||||||
|
contents,
|
||||||
|
from,
|
||||||
|
subject,
|
||||||
|
} = ctx.request.body
|
||||||
let user
|
let user
|
||||||
if (userId) {
|
if (userId) {
|
||||||
const db = new CouchDB(GLOBAL_DB)
|
const db = new CouchDB(GLOBAL_DB)
|
||||||
user = await db.get(userId)
|
user = await db.get(userId)
|
||||||
}
|
}
|
||||||
const response = await sendEmail(email, purpose, { groupId, user, contents, from, subject })
|
const response = await sendEmail(email, purpose, {
|
||||||
|
groupId,
|
||||||
|
user,
|
||||||
|
contents,
|
||||||
|
from,
|
||||||
|
subject,
|
||||||
|
})
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
...response,
|
...response,
|
||||||
message: `Email sent to ${email}.`,
|
message: `Email sent to ${email}.`,
|
||||||
|
|
|
@ -136,7 +136,9 @@ exports.invite = async ctx => {
|
||||||
if (existing) {
|
if (existing) {
|
||||||
ctx.throw(400, "Email address already in use.")
|
ctx.throw(400, "Email address already in use.")
|
||||||
}
|
}
|
||||||
await sendEmail(email, EmailTemplatePurpose.INVITATION, { subject: "{{ company }} platform invitation" })
|
await sendEmail(email, EmailTemplatePurpose.INVITATION, {
|
||||||
|
subject: "{{ company }} platform invitation",
|
||||||
|
})
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
message: "Invitation has been sent.",
|
message: "Invitation has been sent.",
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ exports.sendEmail = async (
|
||||||
{ groupId, user, from, contents, subject } = {}
|
{ groupId, user, from, contents, subject } = {}
|
||||||
) => {
|
) => {
|
||||||
const db = new CouchDB(GLOBAL_DB)
|
const db = new CouchDB(GLOBAL_DB)
|
||||||
let config = await getSmtpConfiguration(db, groupId) || {}
|
let config = (await getSmtpConfiguration(db, groupId)) || {}
|
||||||
if (Object.keys(config).length === 0 && !TEST_MODE) {
|
if (Object.keys(config).length === 0 && !TEST_MODE) {
|
||||||
throw "Unable to find SMTP configuration."
|
throw "Unable to find SMTP configuration."
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ const BASE_COMPANY = "Budibase"
|
||||||
exports.getSettingsTemplateContext = async (purpose, code = null) => {
|
exports.getSettingsTemplateContext = async (purpose, code = null) => {
|
||||||
const db = new CouchDB(StaticDatabases.GLOBAL.name)
|
const db = new CouchDB(StaticDatabases.GLOBAL.name)
|
||||||
// TODO: use more granular settings in the future if required
|
// TODO: use more granular settings in the future if required
|
||||||
let settings = await getScopedConfig(db, { type: Configs.SETTINGS }) || {}
|
let settings = (await getScopedConfig(db, { type: Configs.SETTINGS })) || {}
|
||||||
if (!settings || !settings.platformUrl) {
|
if (!settings || !settings.platformUrl) {
|
||||||
settings.platformUrl = LOCAL_URL
|
settings.platformUrl = LOCAL_URL
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue