@budibase/worker 2.3.18-alpha.20 → 2.3.18-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.3.18-alpha.20",
4
+ "version": "2.3.18-alpha.22",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -36,10 +36,10 @@
36
36
  "author": "Budibase",
37
37
  "license": "GPL-3.0",
38
38
  "dependencies": {
39
- "@budibase/backend-core": "2.3.18-alpha.20",
40
- "@budibase/pro": "2.3.18-alpha.19",
41
- "@budibase/string-templates": "2.3.18-alpha.20",
42
- "@budibase/types": "2.3.18-alpha.20",
39
+ "@budibase/backend-core": "2.3.18-alpha.22",
40
+ "@budibase/pro": "2.3.18-alpha.21",
41
+ "@budibase/string-templates": "2.3.18-alpha.22",
42
+ "@budibase/types": "2.3.18-alpha.22",
43
43
  "@koa/router": "8.0.8",
44
44
  "@sentry/node": "6.17.7",
45
45
  "@techpass/passport-openidconnect": "0.3.2",
@@ -101,5 +101,5 @@
101
101
  "typescript": "4.7.3",
102
102
  "update-dotenv": "1.1.1"
103
103
  },
104
- "gitHead": "6cd323b44be121022e272b02ba6711097648f5b4"
104
+ "gitHead": "f0c08b075569f45413e530f7da508bb7dbe77667"
105
105
  }
@@ -62,7 +62,7 @@ export const login = async (ctx: Ctx<LoginRequest>, next: any) => {
62
62
 
63
63
  const user = await userSdk.getUserByEmail(email)
64
64
  if (user && (await userSdk.isPreventPasswordActions(user))) {
65
- ctx.throw(400, "Password login is disabled for this user")
65
+ ctx.throw(403, "Invalid credentials")
66
66
  }
67
67
 
68
68
  return passport.authenticate(
@@ -106,12 +106,12 @@ describe("/api/global/auth", () => {
106
106
  tenantId,
107
107
  email,
108
108
  password,
109
- { status: 400 }
109
+ { status: 403 }
110
110
  )
111
111
 
112
112
  expect(response.body).toEqual({
113
- message: "Password login is disabled for this user",
114
- status: 400,
113
+ message: "Invalid credentials",
114
+ status: 403,
115
115
  })
116
116
  }
117
117
 
@@ -170,18 +170,8 @@ describe("/api/global/auth", () => {
170
170
  async function testSSOUser() {
171
171
  const { res } = await config.api.auth.requestPasswordReset(
172
172
  sendMailMock,
173
- user.email,
174
- { status: 400 }
173
+ user.email
175
174
  )
176
-
177
- expect(res.body).toEqual({
178
- message: "Password reset is disabled for this user",
179
- status: 400,
180
- error: {
181
- code: "http",
182
- type: "generic",
183
- },
184
- })
185
175
  expect(sendMailMock).not.toHaveBeenCalled()
186
176
  }
187
177
 
@@ -59,7 +59,7 @@ export const reset = async (email: string) => {
59
59
 
60
60
  // exit if user has sso
61
61
  if (await userSdk.isPreventPasswordActions(user)) {
62
- throw new HTTPError("Password reset is disabled for this user", 400)
62
+ return
63
63
  }
64
64
 
65
65
  // send password reset
@@ -61,11 +61,13 @@ export class AuthAPI extends TestAPI {
61
61
 
62
62
  let code: string | undefined
63
63
  if (res.status === 200) {
64
- const emailCall = sendMailMock.mock.calls[0][0]
65
- const parts = emailCall.html.split(
66
- `http://localhost:10000/builder/auth/reset?code=`
67
- )
68
- code = parts[1].split('"')[0].split("&")[0]
64
+ if (sendMailMock.mock.calls.length) {
65
+ const emailCall = sendMailMock.mock.calls[0][0]
66
+ const parts = emailCall.html.split(
67
+ `http://localhost:10000/builder/auth/reset?code=`
68
+ )
69
+ code = parts[1].split('"')[0].split("&")[0]
70
+ }
69
71
  }
70
72
 
71
73
  return { code, res }