mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-27 17:11:14 +01:00
feat(api): schema definition for new credential checking route
This commit is contained in:
@@ -42,6 +42,8 @@ tags:
|
|||||||
paths:
|
paths:
|
||||||
/ping:
|
/ping:
|
||||||
$ref: 'write/ping.yaml'
|
$ref: 'write/ping.yaml'
|
||||||
|
/utilities/login:
|
||||||
|
$ref: 'write/login.yaml'
|
||||||
/users/:
|
/users/:
|
||||||
$ref: 'write/users.yaml'
|
$ref: 'write/users.yaml'
|
||||||
/users/{uid}:
|
/users/{uid}:
|
||||||
|
|||||||
30
public/openapi/write/login.yaml
Normal file
30
public/openapi/write/login.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- utilities
|
||||||
|
summary: verify login credentials
|
||||||
|
description: |
|
||||||
|
This route accepts a username/password or email/password pair (dependent on forum settings), returning a standard user object if credentials are validated successfully.
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
example: admin
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
example: '123456'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: credentials successfully validated
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
status:
|
||||||
|
$ref: ../components/schemas/Status.yaml#/Status
|
||||||
|
response:
|
||||||
|
$ref: ../components/schemas/UserObject.yaml#/UserObjectSlim
|
||||||
@@ -332,7 +332,7 @@ describe('API', async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve with a 200 when called', async () => {
|
it('should not error out when called', async () => {
|
||||||
await setupData();
|
await setupData();
|
||||||
|
|
||||||
if (csrfToken) {
|
if (csrfToken) {
|
||||||
@@ -372,7 +372,7 @@ describe('API', async () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert(!e, `${method.toUpperCase()} ${path} resolved with ${e.message}`);
|
assert(!e, `${method.toUpperCase()} ${path} errored with: ${e.message}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user