acebase-server 1.18.2 → 1.19.1
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/.eslintrc.json +49 -49
- package/.github/workflows/publish.yml +125 -0
- package/Dockerfile +26 -26
- package/LICENSE +21 -21
- package/bin/acebase-server.js +8 -8
- package/create-package-files.sh +25 -0
- package/dist/cjs/middleware/admin-only.js +2 -1
- package/dist/cjs/middleware/user.js +1 -0
- package/dist/cjs/routes/auth-delete.js +3 -2
- package/dist/cjs/routes/auth-signup.js +11 -11
- package/dist/cjs/routes/auth-update.js +2 -1
- package/dist/cjs/routes/auth.js +0 -3
- package/dist/cjs/routes/data-exists.js +2 -2
- package/dist/cjs/routes/data-export.js +2 -2
- package/dist/cjs/routes/data-get.js +2 -2
- package/dist/cjs/routes/data-reflect.js +4 -4
- package/dist/cjs/routes/data-set.js +4 -3
- package/dist/cjs/routes/data-transaction.js +4 -3
- package/dist/cjs/routes/data-update.js +4 -3
- package/dist/cjs/routes/docs.js +1 -1
- package/dist/cjs/routes/meta-info.js +3 -2
- package/dist/cjs/rules.js +2 -1
- package/dist/cjs/schema/user.js +2 -1
- package/dist/cjs/server.js +12 -3
- package/dist/cjs/settings/index.js +6 -0
- package/dist/cjs/shared/admin.js +8 -0
- package/dist/cjs/websocket/index.js +2 -1
- package/dist/esm/middleware/admin-only.js +2 -1
- package/dist/esm/middleware/user.js +1 -0
- package/dist/esm/routes/auth-delete.js +3 -2
- package/dist/esm/routes/auth-signup.js +4 -4
- package/dist/esm/routes/auth-update.js +2 -1
- package/dist/esm/routes/auth.js +0 -3
- package/dist/esm/routes/data-exists.js +1 -2
- package/dist/esm/routes/data-export.js +1 -2
- package/dist/esm/routes/data-get.js +1 -1
- package/dist/esm/routes/data-reflect.js +3 -3
- package/dist/esm/routes/data-set.js +2 -1
- package/dist/esm/routes/data-transaction.js +2 -1
- package/dist/esm/routes/data-update.js +2 -1
- package/dist/esm/routes/docs.js +1 -1
- package/dist/esm/routes/meta-info.js +3 -2
- package/dist/esm/rules.js +2 -1
- package/dist/esm/schema/user.js +1 -0
- package/dist/esm/server.js +12 -3
- package/dist/esm/settings/index.js +6 -0
- package/dist/esm/shared/admin.js +4 -0
- package/dist/esm/websocket/index.js +1 -1
- package/dist/types/middleware/user.d.ts +1 -0
- package/dist/types/routes/auth-update.d.ts +2 -0
- package/dist/types/rules.d.ts +1 -1
- package/dist/types/schema/user.d.ts +4 -0
- package/dist/types/settings/index.d.ts +14 -2
- package/dist/types/shared/admin.d.ts +3 -0
- package/package.json +4 -5
- package/release_notes.md +4 -0
- package/src/routes/auth-change-password.yaml +73 -73
- package/src/routes/auth-delete.yaml +77 -77
- package/src/routes/auth-forgot-password.yaml +49 -49
- package/src/routes/auth-reset-password.yaml +53 -53
- package/src/routes/auth-signin.yaml +129 -129
- package/src/routes/auth-signout.yaml +46 -46
- package/src/routes/auth-signup.yaml +135 -135
- package/src/routes/auth-state.yaml +28 -28
- package/src/routes/auth-update.yaml +151 -151
- package/src/routes/auth-verify-email.yaml +52 -52
- package/src/routes/data-exists.yaml +44 -44
- package/src/routes/data-export.yaml +63 -63
- package/src/routes/data-import.yaml +74 -74
- package/src/routes/data-index-create.yaml +105 -105
- package/src/routes/data-index-delete.yaml +51 -51
- package/src/routes/data-index-list.yaml +84 -84
- package/src/routes/data-query.yaml +165 -165
- package/src/routes/data-reflect.yaml +124 -124
- package/src/routes/data-schema-get.yaml +53 -53
- package/src/routes/data-schema-set.yaml +64 -64
- package/src/routes/data-schema-test.yaml +66 -66
- package/src/routes/data-schemas-list.yaml +41 -41
- package/src/routes/data-set.yaml +77 -77
- package/src/routes/data-sync-changes.yaml +66 -66
- package/src/routes/data-sync-mutations.yaml +66 -66
- package/src/routes/data-transaction-finish.yaml +82 -82
- package/src/routes/data-transaction-start.yaml +58 -58
- package/src/routes/data-update.yaml +77 -77
- package/src/routes/meta-info.yaml +40 -40
- package/src/routes/meta-ping.yaml +22 -22
- package/src/routes/meta-stats.yaml +40 -40
- package/src/routes/oauth2-init.yaml +62 -62
- package/src/routes/oauth2-refresh.yaml +64 -64
- package/src/routes/oauth2-signin.yaml +65 -65
- package/webmanager/acebase-client-browser.min.js +12 -12
- package/webmanager/index.html +271 -271
- package/webmanager/index.js +437 -437
|
@@ -167,7 +167,17 @@ export type AceBaseServerSettings = Partial<{
|
|
|
167
167
|
*/
|
|
168
168
|
logColors: boolean;
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* Callback that runs before the server adds middleware and routes.
|
|
171
|
+
* Use this callback to add custom middleware for logging purposes, header processing etc before the server's own.
|
|
172
|
+
*/
|
|
173
|
+
preMiddleware?: (server: AceBaseServer) => Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Callback that runs after the server has added its middleware, before any routes are added.
|
|
176
|
+
* Use this callback to add custom middleware for logging purposes, header processing etc before the server's own.
|
|
177
|
+
*/
|
|
178
|
+
postMiddleware?: (server: AceBaseServer) => Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Init callback that runs after all middleware (except 404 handler) has been added, before the server starts listening to incoming calls.
|
|
171
181
|
* Use this callback to extend the server with custom routes, add data validation rules, wait for external events, etc.
|
|
172
182
|
* @param server Instance of the `AceBaseServer`
|
|
173
183
|
*/
|
|
@@ -190,7 +200,9 @@ export declare class AceBaseServerConfig {
|
|
|
190
200
|
readonly storage?: AceBaseStorageSettings;
|
|
191
201
|
readonly sponsor: boolean;
|
|
192
202
|
readonly logColors: boolean;
|
|
193
|
-
readonly
|
|
203
|
+
readonly preMiddleware?: AceBaseServerSettings['preMiddleware'];
|
|
204
|
+
readonly postMiddleware?: AceBaseServerSettings['postMiddleware'];
|
|
205
|
+
readonly init?: AceBaseServerSettings['init'];
|
|
194
206
|
constructor(settings: AceBaseServerSettings);
|
|
195
207
|
}
|
|
196
208
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "acebase-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "AceBase realtime database server (webserver endpoint to allow remote connections)",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -22,13 +22,12 @@
|
|
|
22
22
|
"test": "set NODE_ENV=development && npm run start",
|
|
23
23
|
"lint": "eslint .",
|
|
24
24
|
"lint:fix": "eslint . --fix",
|
|
25
|
-
"build": "npm run build:clean && npm run build:esm && npm run build:cjs && npm run build:packages && echo Done!",
|
|
25
|
+
"build": "npm run build:clean && npm run build:esm && npm run build:cjs && npm run build:packages && npm run build:vars && echo Done!",
|
|
26
26
|
"build:clean": "rm -fr dist/*",
|
|
27
27
|
"build:esm": "tsc -p tsconfig.json && npx tsc-esm-fix ---target='dist/esm'",
|
|
28
28
|
"build:cjs": "tsc -p tsconfig-cjs.json",
|
|
29
|
-
"build:packages": "bash ./create-package-files",
|
|
30
|
-
"
|
|
31
|
-
"version": "node ./build-vars.js"
|
|
29
|
+
"build:packages": "bash ./create-package-files.sh",
|
|
30
|
+
"build:vars": "node ./build-vars.js"
|
|
32
31
|
},
|
|
33
32
|
"keywords": [
|
|
34
33
|
"database",
|
package/release_notes.md
ADDED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
/auth/{dbname}/change_password:
|
|
2
|
-
post:
|
|
3
|
-
tags:
|
|
4
|
-
- auth
|
|
5
|
-
summary: Change a user's password
|
|
6
|
-
description: Changes a user account's password by providing the current and new passwords
|
|
7
|
-
parameters:
|
|
8
|
-
- name: dbname
|
|
9
|
-
in: path
|
|
10
|
-
description: name of the database
|
|
11
|
-
required: true
|
|
12
|
-
schema:
|
|
13
|
-
type: string
|
|
14
|
-
example: mydb
|
|
15
|
-
requestBody:
|
|
16
|
-
description: request object
|
|
17
|
-
content:
|
|
18
|
-
'application/json':
|
|
19
|
-
schema:
|
|
20
|
-
type: object
|
|
21
|
-
properties:
|
|
22
|
-
uid:
|
|
23
|
-
type: string
|
|
24
|
-
description: Account's uid
|
|
25
|
-
password:
|
|
26
|
-
type: string
|
|
27
|
-
description: Current password set on the account
|
|
28
|
-
new_password:
|
|
29
|
-
type: string
|
|
30
|
-
description: New password to set on the account
|
|
31
|
-
required:
|
|
32
|
-
- uid
|
|
33
|
-
- password
|
|
34
|
-
- new_password
|
|
35
|
-
responses:
|
|
36
|
-
200:
|
|
37
|
-
description: If the password change is successful, returns an object with a new access token
|
|
38
|
-
content:
|
|
39
|
-
'application/json':
|
|
40
|
-
schema:
|
|
41
|
-
type: object
|
|
42
|
-
properties:
|
|
43
|
-
access_token:
|
|
44
|
-
description: New access token that provides access to API calls that require authentication.
|
|
45
|
-
type: string
|
|
46
|
-
example: ewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
|
|
47
|
-
400:
|
|
48
|
-
description: Returns a `"400 Bad Request"` if the sent request is invalid. If the request is missing details, response is the string `"Bad Request"`. Otherwise, it's an object with `code` and `message` properties. Possible codes are `"unknown_uid"`, `"wrong_password"`, `"wrong_access_token"` (if not signed in as the user the password change was requested for)
|
|
49
|
-
content:
|
|
50
|
-
'text/plain':
|
|
51
|
-
schema:
|
|
52
|
-
type: string
|
|
53
|
-
value: Bad Request
|
|
54
|
-
example: Bad Request
|
|
55
|
-
'application/json':
|
|
56
|
-
schema:
|
|
57
|
-
$ref: '#/components/schemas/Error'
|
|
58
|
-
example:
|
|
59
|
-
code: wrong_access_token
|
|
60
|
-
message: "Cannot change password while signed in as other user, or with an old token"
|
|
61
|
-
422:
|
|
62
|
-
description: New password does not meet the criteria
|
|
63
|
-
content:
|
|
64
|
-
'text/plain':
|
|
65
|
-
schema:
|
|
66
|
-
type: string
|
|
67
|
-
value: "Invalid new password, must be at least 8 characters and contain a combination of numbers and letters (both lower and uppercase)"
|
|
68
|
-
example: "Invalid new password, must be at least 8 characters and contain a combination of numbers and letters (both lower and uppercase)"
|
|
69
|
-
500:
|
|
70
|
-
description: An unexpected error occurred
|
|
71
|
-
content:
|
|
72
|
-
'application/json':
|
|
73
|
-
schema:
|
|
1
|
+
/auth/{dbname}/change_password:
|
|
2
|
+
post:
|
|
3
|
+
tags:
|
|
4
|
+
- auth
|
|
5
|
+
summary: Change a user's password
|
|
6
|
+
description: Changes a user account's password by providing the current and new passwords
|
|
7
|
+
parameters:
|
|
8
|
+
- name: dbname
|
|
9
|
+
in: path
|
|
10
|
+
description: name of the database
|
|
11
|
+
required: true
|
|
12
|
+
schema:
|
|
13
|
+
type: string
|
|
14
|
+
example: mydb
|
|
15
|
+
requestBody:
|
|
16
|
+
description: request object
|
|
17
|
+
content:
|
|
18
|
+
'application/json':
|
|
19
|
+
schema:
|
|
20
|
+
type: object
|
|
21
|
+
properties:
|
|
22
|
+
uid:
|
|
23
|
+
type: string
|
|
24
|
+
description: Account's uid
|
|
25
|
+
password:
|
|
26
|
+
type: string
|
|
27
|
+
description: Current password set on the account
|
|
28
|
+
new_password:
|
|
29
|
+
type: string
|
|
30
|
+
description: New password to set on the account
|
|
31
|
+
required:
|
|
32
|
+
- uid
|
|
33
|
+
- password
|
|
34
|
+
- new_password
|
|
35
|
+
responses:
|
|
36
|
+
200:
|
|
37
|
+
description: If the password change is successful, returns an object with a new access token
|
|
38
|
+
content:
|
|
39
|
+
'application/json':
|
|
40
|
+
schema:
|
|
41
|
+
type: object
|
|
42
|
+
properties:
|
|
43
|
+
access_token:
|
|
44
|
+
description: New access token that provides access to API calls that require authentication.
|
|
45
|
+
type: string
|
|
46
|
+
example: ewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
|
|
47
|
+
400:
|
|
48
|
+
description: Returns a `"400 Bad Request"` if the sent request is invalid. If the request is missing details, response is the string `"Bad Request"`. Otherwise, it's an object with `code` and `message` properties. Possible codes are `"unknown_uid"`, `"wrong_password"`, `"wrong_access_token"` (if not signed in as the user the password change was requested for)
|
|
49
|
+
content:
|
|
50
|
+
'text/plain':
|
|
51
|
+
schema:
|
|
52
|
+
type: string
|
|
53
|
+
value: Bad Request
|
|
54
|
+
example: Bad Request
|
|
55
|
+
'application/json':
|
|
56
|
+
schema:
|
|
57
|
+
$ref: '#/components/schemas/Error'
|
|
58
|
+
example:
|
|
59
|
+
code: wrong_access_token
|
|
60
|
+
message: "Cannot change password while signed in as other user, or with an old token"
|
|
61
|
+
422:
|
|
62
|
+
description: New password does not meet the criteria
|
|
63
|
+
content:
|
|
64
|
+
'text/plain':
|
|
65
|
+
schema:
|
|
66
|
+
type: string
|
|
67
|
+
value: "Invalid new password, must be at least 8 characters and contain a combination of numbers and letters (both lower and uppercase)"
|
|
68
|
+
example: "Invalid new password, must be at least 8 characters and contain a combination of numbers and letters (both lower and uppercase)"
|
|
69
|
+
500:
|
|
70
|
+
description: An unexpected error occurred
|
|
71
|
+
content:
|
|
72
|
+
'application/json':
|
|
73
|
+
schema:
|
|
74
74
|
$ref: '#/components/schemas/UnexpectedError'
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
/auth/{dbname}/delete:
|
|
2
|
-
post:
|
|
3
|
-
tags:
|
|
4
|
-
- auth
|
|
5
|
-
summary: Delete a user account
|
|
6
|
-
description: Deletes an existing user account
|
|
7
|
-
parameters:
|
|
8
|
-
- name: dbname
|
|
9
|
-
in: path
|
|
10
|
-
description: name of the database
|
|
11
|
-
required: true
|
|
12
|
-
schema:
|
|
13
|
-
type: string
|
|
14
|
-
example: mydb
|
|
15
|
-
requestBody:
|
|
16
|
-
description: Account to delete
|
|
17
|
-
content:
|
|
18
|
-
'text/plain':
|
|
19
|
-
schema:
|
|
20
|
-
type: string
|
|
21
|
-
value: ''
|
|
22
|
-
example: ''
|
|
23
|
-
description: Empty content to delete signed in user account
|
|
24
|
-
'application/json':
|
|
25
|
-
schema:
|
|
26
|
-
type: object
|
|
27
|
-
properties:
|
|
28
|
-
uid:
|
|
29
|
-
type: string
|
|
30
|
-
description: (admin user only) to delete a specific user account, the target account `uid` must be passed with the request
|
|
31
|
-
example: jpx0k53u0002ecr7s354c51l
|
|
32
|
-
responses:
|
|
33
|
-
200:
|
|
34
|
-
description: When delete succeeds, it returns the string `"Farewell"`
|
|
35
|
-
content:
|
|
36
|
-
'text/plain':
|
|
37
|
-
schema:
|
|
38
|
-
type: text
|
|
39
|
-
value: Farewell
|
|
40
|
-
example: Farewell
|
|
41
|
-
401:
|
|
42
|
-
description: If this is an unauthenticated request (not signed in), `"401 Unauthorized"` is returned
|
|
43
|
-
content:
|
|
44
|
-
'application/json':
|
|
45
|
-
schema:
|
|
46
|
-
type: object
|
|
47
|
-
properties:
|
|
48
|
-
code:
|
|
49
|
-
type: string
|
|
50
|
-
value: unauthenticated_delete
|
|
51
|
-
message:
|
|
52
|
-
type: string
|
|
53
|
-
value: You are not authorized to perform this operation, your attempt has been logged
|
|
54
|
-
example:
|
|
55
|
-
code: unauthenticated_delete
|
|
56
|
-
message: You are not authorized to perform this operation, your attempt has been logged
|
|
57
|
-
403:
|
|
58
|
-
description: If a non-admin user tries to update a user's account details, `"403 Forbidden"` is returned
|
|
59
|
-
content:
|
|
60
|
-
'application/json':
|
|
61
|
-
schema:
|
|
62
|
-
type: object
|
|
63
|
-
properties:
|
|
64
|
-
code:
|
|
65
|
-
type: string
|
|
66
|
-
value: unauthorized_delete
|
|
67
|
-
message:
|
|
68
|
-
type: string
|
|
69
|
-
value: You are not authorized to perform this operation. This attempt has been logged.
|
|
70
|
-
example:
|
|
71
|
-
code: unauthorized_delete
|
|
72
|
-
message: You are not authorized to perform this operation. This attempt has been logged.
|
|
73
|
-
500:
|
|
74
|
-
description: An unenexpected error occurred on the server
|
|
75
|
-
content:
|
|
76
|
-
'application/json':
|
|
77
|
-
schema:
|
|
1
|
+
/auth/{dbname}/delete:
|
|
2
|
+
post:
|
|
3
|
+
tags:
|
|
4
|
+
- auth
|
|
5
|
+
summary: Delete a user account
|
|
6
|
+
description: Deletes an existing user account
|
|
7
|
+
parameters:
|
|
8
|
+
- name: dbname
|
|
9
|
+
in: path
|
|
10
|
+
description: name of the database
|
|
11
|
+
required: true
|
|
12
|
+
schema:
|
|
13
|
+
type: string
|
|
14
|
+
example: mydb
|
|
15
|
+
requestBody:
|
|
16
|
+
description: Account to delete
|
|
17
|
+
content:
|
|
18
|
+
'text/plain':
|
|
19
|
+
schema:
|
|
20
|
+
type: string
|
|
21
|
+
value: ''
|
|
22
|
+
example: ''
|
|
23
|
+
description: Empty content to delete signed in user account
|
|
24
|
+
'application/json':
|
|
25
|
+
schema:
|
|
26
|
+
type: object
|
|
27
|
+
properties:
|
|
28
|
+
uid:
|
|
29
|
+
type: string
|
|
30
|
+
description: (admin user only) to delete a specific user account, the target account `uid` must be passed with the request
|
|
31
|
+
example: jpx0k53u0002ecr7s354c51l
|
|
32
|
+
responses:
|
|
33
|
+
200:
|
|
34
|
+
description: When delete succeeds, it returns the string `"Farewell"`
|
|
35
|
+
content:
|
|
36
|
+
'text/plain':
|
|
37
|
+
schema:
|
|
38
|
+
type: text
|
|
39
|
+
value: Farewell
|
|
40
|
+
example: Farewell
|
|
41
|
+
401:
|
|
42
|
+
description: If this is an unauthenticated request (not signed in), `"401 Unauthorized"` is returned
|
|
43
|
+
content:
|
|
44
|
+
'application/json':
|
|
45
|
+
schema:
|
|
46
|
+
type: object
|
|
47
|
+
properties:
|
|
48
|
+
code:
|
|
49
|
+
type: string
|
|
50
|
+
value: unauthenticated_delete
|
|
51
|
+
message:
|
|
52
|
+
type: string
|
|
53
|
+
value: You are not authorized to perform this operation, your attempt has been logged
|
|
54
|
+
example:
|
|
55
|
+
code: unauthenticated_delete
|
|
56
|
+
message: You are not authorized to perform this operation, your attempt has been logged
|
|
57
|
+
403:
|
|
58
|
+
description: If a non-admin user tries to update a user's account details, `"403 Forbidden"` is returned
|
|
59
|
+
content:
|
|
60
|
+
'application/json':
|
|
61
|
+
schema:
|
|
62
|
+
type: object
|
|
63
|
+
properties:
|
|
64
|
+
code:
|
|
65
|
+
type: string
|
|
66
|
+
value: unauthorized_delete
|
|
67
|
+
message:
|
|
68
|
+
type: string
|
|
69
|
+
value: You are not authorized to perform this operation. This attempt has been logged.
|
|
70
|
+
example:
|
|
71
|
+
code: unauthorized_delete
|
|
72
|
+
message: You are not authorized to perform this operation. This attempt has been logged.
|
|
73
|
+
500:
|
|
74
|
+
description: An unenexpected error occurred on the server
|
|
75
|
+
content:
|
|
76
|
+
'application/json':
|
|
77
|
+
schema:
|
|
78
78
|
$ref: '#/components/schemas/UnexpectedError'
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/auth/{dbname}/forgot_password:
|
|
2
|
-
post:
|
|
3
|
-
tags:
|
|
4
|
-
- auth
|
|
5
|
-
summary: Issue a password reset
|
|
6
|
-
description: Issues a password reset for a user that forgot their password. User must have an email address in the database.
|
|
7
|
-
parameters:
|
|
8
|
-
- name: dbname
|
|
9
|
-
in: path
|
|
10
|
-
description: name of the database
|
|
11
|
-
required: true
|
|
12
|
-
schema:
|
|
13
|
-
type: string
|
|
14
|
-
example: mydb
|
|
15
|
-
requestBody:
|
|
16
|
-
description: user details
|
|
17
|
-
content:
|
|
18
|
-
'application/json':
|
|
19
|
-
schema:
|
|
20
|
-
type: object
|
|
21
|
-
properties:
|
|
22
|
-
email:
|
|
23
|
-
type: string
|
|
24
|
-
description: User's email address. A password reset email will be sent to this address
|
|
25
|
-
required:
|
|
26
|
-
- email
|
|
27
|
-
responses:
|
|
28
|
-
200:
|
|
29
|
-
description: If a password reset email has been successfully sent, returns the string `"OK"`
|
|
30
|
-
content:
|
|
31
|
-
'text/plain':
|
|
32
|
-
schema:
|
|
33
|
-
type: 'string'
|
|
34
|
-
value: OK
|
|
35
|
-
description: The string `"OK"`
|
|
36
|
-
400:
|
|
37
|
-
description: Returns a `"400 Bad Request"` if the server has not been configured properly, or if no or invalid email address was sent with the request
|
|
38
|
-
content:
|
|
39
|
-
'application/json':
|
|
40
|
-
schema:
|
|
41
|
-
$ref: '#/components/schemas/Error'
|
|
42
|
-
example:
|
|
43
|
-
code: invalid_email
|
|
44
|
-
message: Email address not found, or duplicate entries found
|
|
45
|
-
500:
|
|
46
|
-
description: An unexpected error occurred
|
|
47
|
-
content:
|
|
48
|
-
'application/json':
|
|
49
|
-
schema:
|
|
1
|
+
/auth/{dbname}/forgot_password:
|
|
2
|
+
post:
|
|
3
|
+
tags:
|
|
4
|
+
- auth
|
|
5
|
+
summary: Issue a password reset
|
|
6
|
+
description: Issues a password reset for a user that forgot their password. User must have an email address in the database.
|
|
7
|
+
parameters:
|
|
8
|
+
- name: dbname
|
|
9
|
+
in: path
|
|
10
|
+
description: name of the database
|
|
11
|
+
required: true
|
|
12
|
+
schema:
|
|
13
|
+
type: string
|
|
14
|
+
example: mydb
|
|
15
|
+
requestBody:
|
|
16
|
+
description: user details
|
|
17
|
+
content:
|
|
18
|
+
'application/json':
|
|
19
|
+
schema:
|
|
20
|
+
type: object
|
|
21
|
+
properties:
|
|
22
|
+
email:
|
|
23
|
+
type: string
|
|
24
|
+
description: User's email address. A password reset email will be sent to this address
|
|
25
|
+
required:
|
|
26
|
+
- email
|
|
27
|
+
responses:
|
|
28
|
+
200:
|
|
29
|
+
description: If a password reset email has been successfully sent, returns the string `"OK"`
|
|
30
|
+
content:
|
|
31
|
+
'text/plain':
|
|
32
|
+
schema:
|
|
33
|
+
type: 'string'
|
|
34
|
+
value: OK
|
|
35
|
+
description: The string `"OK"`
|
|
36
|
+
400:
|
|
37
|
+
description: Returns a `"400 Bad Request"` if the server has not been configured properly, or if no or invalid email address was sent with the request
|
|
38
|
+
content:
|
|
39
|
+
'application/json':
|
|
40
|
+
schema:
|
|
41
|
+
$ref: '#/components/schemas/Error'
|
|
42
|
+
example:
|
|
43
|
+
code: invalid_email
|
|
44
|
+
message: Email address not found, or duplicate entries found
|
|
45
|
+
500:
|
|
46
|
+
description: An unexpected error occurred
|
|
47
|
+
content:
|
|
48
|
+
'application/json':
|
|
49
|
+
schema:
|
|
50
50
|
$ref: '#/components/schemas/UnexpectedError'
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
/auth/{dbname}/reset_password:
|
|
2
|
-
post:
|
|
3
|
-
tags:
|
|
4
|
-
- auth
|
|
5
|
-
summary: Completes a password reset
|
|
6
|
-
description: Completes a password reset request for a user account with a code sent to the email address by the `forgot_password` endpoint
|
|
7
|
-
parameters:
|
|
8
|
-
- name: dbname
|
|
9
|
-
in: path
|
|
10
|
-
description: name of the database
|
|
11
|
-
required: true
|
|
12
|
-
schema:
|
|
13
|
-
type: string
|
|
14
|
-
example: mydb
|
|
15
|
-
requestBody:
|
|
16
|
-
description: verification object
|
|
17
|
-
content:
|
|
18
|
-
'application/json':
|
|
19
|
-
schema:
|
|
20
|
-
type: object
|
|
21
|
-
properties:
|
|
22
|
-
code:
|
|
23
|
-
type: string
|
|
24
|
-
description: Password reset code that was sent to the user's email address
|
|
25
|
-
password:
|
|
26
|
-
type: string
|
|
27
|
-
description: New password to set on the account
|
|
28
|
-
required:
|
|
29
|
-
- code
|
|
30
|
-
- password
|
|
31
|
-
responses:
|
|
32
|
-
200:
|
|
33
|
-
description: If the password reset is successful, returns the string `"OK"`
|
|
34
|
-
content:
|
|
35
|
-
'text/plain':
|
|
36
|
-
schema:
|
|
37
|
-
type: 'string'
|
|
38
|
-
value: OK
|
|
39
|
-
description: The string `"OK"`
|
|
40
|
-
400:
|
|
41
|
-
description: Returns a `"401 Bad Request"` if the code sent with the request is invalid, or the new password doesn't meet the requirements
|
|
42
|
-
content:
|
|
43
|
-
'application/json':
|
|
44
|
-
schema:
|
|
45
|
-
$ref: '#/components/schemas/Error'
|
|
46
|
-
example:
|
|
47
|
-
code: invalid_code
|
|
48
|
-
message: Invalid token
|
|
49
|
-
500:
|
|
50
|
-
description: An unexpected error occurred
|
|
51
|
-
content:
|
|
52
|
-
'application/json':
|
|
53
|
-
schema:
|
|
1
|
+
/auth/{dbname}/reset_password:
|
|
2
|
+
post:
|
|
3
|
+
tags:
|
|
4
|
+
- auth
|
|
5
|
+
summary: Completes a password reset
|
|
6
|
+
description: Completes a password reset request for a user account with a code sent to the email address by the `forgot_password` endpoint
|
|
7
|
+
parameters:
|
|
8
|
+
- name: dbname
|
|
9
|
+
in: path
|
|
10
|
+
description: name of the database
|
|
11
|
+
required: true
|
|
12
|
+
schema:
|
|
13
|
+
type: string
|
|
14
|
+
example: mydb
|
|
15
|
+
requestBody:
|
|
16
|
+
description: verification object
|
|
17
|
+
content:
|
|
18
|
+
'application/json':
|
|
19
|
+
schema:
|
|
20
|
+
type: object
|
|
21
|
+
properties:
|
|
22
|
+
code:
|
|
23
|
+
type: string
|
|
24
|
+
description: Password reset code that was sent to the user's email address
|
|
25
|
+
password:
|
|
26
|
+
type: string
|
|
27
|
+
description: New password to set on the account
|
|
28
|
+
required:
|
|
29
|
+
- code
|
|
30
|
+
- password
|
|
31
|
+
responses:
|
|
32
|
+
200:
|
|
33
|
+
description: If the password reset is successful, returns the string `"OK"`
|
|
34
|
+
content:
|
|
35
|
+
'text/plain':
|
|
36
|
+
schema:
|
|
37
|
+
type: 'string'
|
|
38
|
+
value: OK
|
|
39
|
+
description: The string `"OK"`
|
|
40
|
+
400:
|
|
41
|
+
description: Returns a `"401 Bad Request"` if the code sent with the request is invalid, or the new password doesn't meet the requirements
|
|
42
|
+
content:
|
|
43
|
+
'application/json':
|
|
44
|
+
schema:
|
|
45
|
+
$ref: '#/components/schemas/Error'
|
|
46
|
+
example:
|
|
47
|
+
code: invalid_code
|
|
48
|
+
message: Invalid token
|
|
49
|
+
500:
|
|
50
|
+
description: An unexpected error occurred
|
|
51
|
+
content:
|
|
52
|
+
'application/json':
|
|
53
|
+
schema:
|
|
54
54
|
$ref: '#/components/schemas/UnexpectedError'
|