Linting.
This commit is contained in:
parent
7743384f77
commit
f3ce979230
|
@ -1,6 +1,5 @@
|
|||
const { newid } = require("../hashing")
|
||||
const Replication = require("./Replication")
|
||||
const { getDB } = require("./index")
|
||||
const { DEFAULT_TENANT_ID } = require("../constants")
|
||||
const env = require("../environment")
|
||||
const { StaticDatabases, SEPARATOR } = require("./constants")
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
const {
|
||||
createTenancyContext,
|
||||
setTenantId,
|
||||
} = require("../tenancy")
|
||||
const { createTenancyContext, setTenantId } = require("../tenancy")
|
||||
const { buildMatcherRegex, matches } = require("./matchers")
|
||||
|
||||
module.exports = (allowQueryStringPatterns, noTenancyPatterns) => {
|
||||
|
|
|
@ -76,7 +76,7 @@ exports.getGlobalDB = (tenantId = null) => {
|
|||
// tenant ID can be set externally, for example user API where
|
||||
// new tenants are being created, this may be the case
|
||||
if (!tenantId) {
|
||||
const tenantId = getTenantId()
|
||||
tenantId = getTenantId()
|
||||
}
|
||||
|
||||
let dbName
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
const {
|
||||
DocumentTypes,
|
||||
SEPARATOR,
|
||||
ViewNames,
|
||||
} = require("./db/utils")
|
||||
const { DocumentTypes, SEPARATOR, ViewNames } = require("./db/utils")
|
||||
const jwt = require("jsonwebtoken")
|
||||
const { options } = require("./middleware/passport/jwt")
|
||||
const { createUserEmailView } = require("./db/views")
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const Router = require("@koa/router")
|
||||
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } = require("@budibase/auth").auth
|
||||
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } =
|
||||
require("@budibase/auth").auth
|
||||
const currentApp = require("../middleware/currentapp")
|
||||
const compress = require("koa-compress")
|
||||
const zlib = require("zlib")
|
||||
|
|
|
@ -8,7 +8,11 @@ const { setCookie, getCookie, clearCookie, getGlobalUserByEmail, hash } =
|
|||
const { Cookies } = authPkg.constants
|
||||
const { passport } = authPkg.auth
|
||||
const { checkResetPasswordCode } = require("../../../utilities/redis")
|
||||
const { getGlobalDB, getTenantId, isMultiTenant } = require("@budibase/auth/tenancy")
|
||||
const {
|
||||
getGlobalDB,
|
||||
getTenantId,
|
||||
isMultiTenant,
|
||||
} = require("@budibase/auth/tenancy")
|
||||
const env = require("../../../environment")
|
||||
|
||||
function googleCallbackUrl() {
|
||||
|
|
|
@ -2,15 +2,8 @@ const { sendEmail } = require("../../../utilities/email")
|
|||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
|
||||
exports.sendEmail = async ctx => {
|
||||
let {
|
||||
workspaceId,
|
||||
email,
|
||||
userId,
|
||||
purpose,
|
||||
contents,
|
||||
from,
|
||||
subject,
|
||||
} = ctx.request.body
|
||||
let { workspaceId, email, userId, purpose, contents, from, subject } =
|
||||
ctx.request.body
|
||||
let user
|
||||
if (userId) {
|
||||
const db = getGlobalDB()
|
||||
|
|
|
@ -330,13 +330,16 @@ exports.inviteAccept = async ctx => {
|
|||
try {
|
||||
// info is an extension of the user object that was stored by global
|
||||
const { email, info } = await checkInviteCode(inviteCode)
|
||||
ctx.body = await saveUser({
|
||||
ctx.body = await saveUser(
|
||||
{
|
||||
firstName,
|
||||
lastName,
|
||||
password,
|
||||
email,
|
||||
...info,
|
||||
}, info.tenantId)
|
||||
},
|
||||
info.tenantId
|
||||
)
|
||||
// this will flesh out the body response
|
||||
await exports.save(ctx)
|
||||
} catch (err) {
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
const {
|
||||
getWorkspaceParams,
|
||||
generateWorkspaceID,
|
||||
} = require("@budibase/auth/db")
|
||||
const { getWorkspaceParams, generateWorkspaceID } = require("@budibase/auth/db")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
|
||||
exports.save = async function (ctx) {
|
||||
|
|
|
@ -2,7 +2,8 @@ const Router = require("@koa/router")
|
|||
const compress = require("koa-compress")
|
||||
const zlib = require("zlib")
|
||||
const { routes } = require("./routes")
|
||||
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } = require("@budibase/auth").auth
|
||||
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } =
|
||||
require("@budibase/auth").auth
|
||||
|
||||
const NO_TENANCY_ENDPOINTS = [
|
||||
{
|
||||
|
@ -12,7 +13,7 @@ const NO_TENANCY_ENDPOINTS = [
|
|||
{
|
||||
route: "/api/global/users/self",
|
||||
method: "GET",
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
const PUBLIC_ENDPOINTS = [
|
||||
|
|
|
@ -6,9 +6,7 @@ const {
|
|||
GLOBAL_OWNER,
|
||||
} = require("../index")
|
||||
const { join } = require("path")
|
||||
const {
|
||||
getTemplateParams,
|
||||
} = require("@budibase/auth/db")
|
||||
const { getTemplateParams } = require("@budibase/auth/db")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
|
||||
exports.EmailTemplates = {
|
||||
|
|
|
@ -68,12 +68,7 @@ async function getLinkCode(purpose, email, user, info = null) {
|
|||
* @param {string|null} contents if using a custom template can supply contents for context.
|
||||
* @return {Promise<string>} returns the built email HTML if all provided parameters were valid.
|
||||
*/
|
||||
async function buildEmail(
|
||||
purpose,
|
||||
email,
|
||||
context,
|
||||
{ user, contents } = {}
|
||||
) {
|
||||
async function buildEmail(purpose, email, context, { user, contents } = {}) {
|
||||
// this isn't a full email
|
||||
if (FULL_EMAIL_PURPOSES.indexOf(purpose) === -1) {
|
||||
throw `Unable to build an email of type ${purpose}`
|
||||
|
|
|
@ -44,9 +44,7 @@ exports.getSettingsTemplateContext = async (purpose, code = null) => {
|
|||
case EmailTemplatePurpose.INVITATION:
|
||||
context[InternalTemplateBindings.INVITE_CODE] = code
|
||||
context[InternalTemplateBindings.INVITE_URL] = checkSlashesInUrl(
|
||||
addTenantToUrl(
|
||||
`${URL}/builder/invite?code=${code}`
|
||||
)
|
||||
addTenantToUrl(`${URL}/builder/invite?code=${code}`)
|
||||
)
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue