docs: update OAS of reset password routes (#11711)
This commit is contained in:
1 parent
7dbec10b3b
commit
c2e24b6cfd
6 files changed
+34
-19
No files matched your search
+11
-1
@@ -1,6 +1,7 @@
|
|||||||
import { useBaseSpecs } from "@/providers/base-specs"
|
import { useBaseSpecs } from "@/providers/base-specs"
|
||||||
import type { OpenAPIV3 } from "openapi-types"
|
import type { OpenAPIV3 } from "openapi-types"
|
||||||
import { Card } from "docs-ui"
|
import { Card } from "docs-ui"
|
||||||
|
import { useMemo } from "react"
|
||||||
|
|
||||||
export type TagsOperationDescriptionSectionSecurityProps = {
|
export type TagsOperationDescriptionSectionSecurityProps = {
|
||||||
security: OpenAPIV3.SecurityRequirementObject[]
|
security: OpenAPIV3.SecurityRequirementObject[]
|
||||||
@@ -11,6 +12,15 @@ const TagsOperationDescriptionSectionSecurity = ({
|
|||||||
}: TagsOperationDescriptionSectionSecurityProps) => {
|
}: TagsOperationDescriptionSectionSecurityProps) => {
|
||||||
const { getSecuritySchema } = useBaseSpecs()
|
const { getSecuritySchema } = useBaseSpecs()
|
||||||
|
|
||||||
|
const linkToAuth = useMemo(() => {
|
||||||
|
const hasNoAuth = security.some((item) => {
|
||||||
|
const schema = getSecuritySchema(Object.keys(item)[0])
|
||||||
|
return schema && schema["x-is-auth"] === false
|
||||||
|
})
|
||||||
|
|
||||||
|
return !hasNoAuth
|
||||||
|
}, [security, getSecuritySchema])
|
||||||
|
|
||||||
const getDescription = () => {
|
const getDescription = () => {
|
||||||
let str = ""
|
let str = ""
|
||||||
security.forEach((item) => {
|
security.forEach((item) => {
|
||||||
@@ -27,7 +37,7 @@ const TagsOperationDescriptionSectionSecurity = ({
|
|||||||
<Card
|
<Card
|
||||||
title="Authorization"
|
title="Authorization"
|
||||||
text={getDescription()}
|
text={getDescription()}
|
||||||
href="#authentication"
|
href={linkToAuth ? "#authentication" : undefined}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ export type PropertiesObject = {
|
|||||||
|
|
||||||
export type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject & {
|
export type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject & {
|
||||||
"x-displayName"?: string
|
"x-displayName"?: string
|
||||||
|
"x-is-auth"?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Parameter = OpenAPIV3.ParameterObject & {
|
export type Parameter = OpenAPIV3.ParameterObject & {
|
||||||
|
|||||||
@@ -749,3 +749,8 @@ components:
|
|||||||
in: cookie
|
in: cookie
|
||||||
name: connect.sid
|
name: connect.sid
|
||||||
x-displayName: Cookie Session ID
|
x-displayName: Cookie Session ID
|
||||||
|
reset_password:
|
||||||
|
type: http
|
||||||
|
x-displayName: Reset Password Token
|
||||||
|
scheme: bearer
|
||||||
|
x-is-auth: false
|
||||||
@@ -349,3 +349,8 @@ components:
|
|||||||
x-displayName: Cookie Session ID
|
x-displayName: Cookie Session ID
|
||||||
in: cookie
|
in: cookie
|
||||||
name: connect.sid
|
name: connect.sid
|
||||||
|
reset_password:
|
||||||
|
type: http
|
||||||
|
x-displayName: Reset Password Token
|
||||||
|
scheme: bearer
|
||||||
|
x-is-auth: false
|
||||||
+6
-9
@@ -3,11 +3,11 @@
|
|||||||
* operationId: PostActor_typeAuth_providerUpdate
|
* operationId: PostActor_typeAuth_providerUpdate
|
||||||
* summary: Reset an Admin User's Password
|
* summary: Reset an Admin User's Password
|
||||||
* x-sidebar-summary: Reset Password
|
* x-sidebar-summary: Reset Password
|
||||||
* description: Reset an admin user's password using a reset-password token generated with the [Generate Reset Password Token API route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providerresetpassword).
|
* description: Reset an admin user's password using a reset-password token generated with the [Generate Reset Password Token API route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providerresetpassword). You pass the token as a bearer token in the request's Authorization header.
|
||||||
* externalDocs:
|
* externalDocs:
|
||||||
* url: https://docs.medusajs.com/v2/resources/commerce-modules/auth/authentication-route#reset-password-route
|
* url: https://docs.medusajs.com/v2/resources/commerce-modules/auth/authentication-route#reset-password-route
|
||||||
* description: Learn more about this API route.
|
* description: Learn more about this API route.
|
||||||
* x-authenticated: false
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - name: auth_provider
|
* - name: auth_provider
|
||||||
* in: path
|
* in: path
|
||||||
@@ -16,12 +16,6 @@
|
|||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
* example: "emailpass"
|
* example: "emailpass"
|
||||||
* - name: token
|
|
||||||
* in: query
|
|
||||||
* description: The reset password token received using the Get Reset Password API route.
|
|
||||||
* required: true
|
|
||||||
* schema:
|
|
||||||
* type: string
|
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
@@ -36,12 +30,15 @@
|
|||||||
* - lang: Shell
|
* - lang: Shell
|
||||||
* label: cURL
|
* label: cURL
|
||||||
* source: |-
|
* source: |-
|
||||||
* curl -X POST '{backend_url}/auth/user/emailpass/update?token=123' \
|
* curl -X POST '{backend_url}/auth/user/emailpass/update' \
|
||||||
* -H 'Content-Type: application/json' \
|
* -H 'Content-Type: application/json' \
|
||||||
|
* -H 'Authorization: Bearer {token}' \
|
||||||
* --data-raw '{
|
* --data-raw '{
|
||||||
* "email": "admin@medusa-test.com",
|
* "email": "admin@medusa-test.com",
|
||||||
* "password": "supersecret"
|
* "password": "supersecret"
|
||||||
* }'
|
* }'
|
||||||
|
* security:
|
||||||
|
* - reset_password: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Auth
|
* - Auth
|
||||||
* responses:
|
* responses:
|
||||||
|
|||||||
+6
-9
@@ -3,11 +3,11 @@
|
|||||||
* operationId: PostActor_typeAuth_providerUpdate
|
* operationId: PostActor_typeAuth_providerUpdate
|
||||||
* summary: Reset a Customer's Password
|
* summary: Reset a Customer's Password
|
||||||
* x-sidebar-summary: Reset Password
|
* x-sidebar-summary: Reset Password
|
||||||
* description: Reset a customer's password using a reset-password token generated with the [Generate Reset Password Token API route](https://docs.medusajs.com/api/store#auth_postactor_typeauth_providerresetpassword).
|
* description: Reset a customer's password using a reset-password token generated with the [Generate Reset Password Token API route](https://docs.medusajs.com/api/store#auth_postactor_typeauth_providerresetpassword). You pass the token as a bearer token in the request's Authorization header.
|
||||||
* externalDocs:
|
* externalDocs:
|
||||||
* url: https://docs.medusajs.com/v2/resources/storefront-development/customers/reset-password#2-reset-password-page
|
* url: https://docs.medusajs.com/v2/resources/storefront-development/customers/reset-password#2-reset-password-page
|
||||||
* description: "Storefront development: How to create the reset password page."
|
* description: "Storefront development: How to create the reset password page."
|
||||||
* x-authenticated: false
|
* x-authenticated: true
|
||||||
* parameters:
|
* parameters:
|
||||||
* - name: auth_provider
|
* - name: auth_provider
|
||||||
* in: path
|
* in: path
|
||||||
@@ -16,12 +16,6 @@
|
|||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
* example: "emailpass"
|
* example: "emailpass"
|
||||||
* - name: token
|
|
||||||
* in: query
|
|
||||||
* description: The reset password token received using the Get Reset Password API route.
|
|
||||||
* required: true
|
|
||||||
* schema:
|
|
||||||
* type: string
|
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
@@ -36,12 +30,15 @@
|
|||||||
* - lang: Shell
|
* - lang: Shell
|
||||||
* label: cURL
|
* label: cURL
|
||||||
* source: |-
|
* source: |-
|
||||||
* curl -X POST '{backend_url}/auth/customer/emailpass/update?token=123' \
|
* curl -X POST '{backend_url}/auth/customer/emailpass/update' \
|
||||||
* -H 'Content-Type: application/json' \
|
* -H 'Content-Type: application/json' \
|
||||||
|
* -H 'Authorization: Bearer {token}' \
|
||||||
* --data-raw '{
|
* --data-raw '{
|
||||||
* "email": "customer@gmail.com",
|
* "email": "customer@gmail.com",
|
||||||
* "password": "supersecret"
|
* "password": "supersecret"
|
||||||
* }'
|
* }'
|
||||||
|
* security:
|
||||||
|
* - reset_password: []
|
||||||
* tags:
|
* tags:
|
||||||
* - Auth
|
* - Auth
|
||||||
* responses:
|
* responses:
|
||||||
|
|||||||
Reference in new issue
Block a user