Skip to content

Commit

Permalink
Merge pull request #9475 from goofmint/fix/doc-v3-forgot-password
Browse files Browse the repository at this point in the history
support(jsdoc): Add document to forgot-password.js
  • Loading branch information
yuki-takei authored Dec 11, 2024
2 parents 46df8f9 + 9c634c4 commit c7b976e
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions apps/app/src/server/routes/apiv3/forgot-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ const logger = loggerFactory('growi:routes:apiv3:forgotPassword'); // eslint-dis
const express = require('express');
const { body } = require('express-validator');

/**
* @swagger
*
* components:
* schemas:
* PasswordResetRequest:
* type: object
* properties:
* email:
* type: string
* format: email
* PasswordResetResponse:
* type: object
* properties:
* message:
* type: string
* error:
* type: string
*/

const router = express.Router();

Expand Down Expand Up @@ -69,6 +88,34 @@ module.exports = (crowi) => {
});
}

/**
* @swagger
*
* /forgot-password:
* post:
* summary: Request password reset
* tags: [Users]
* security:
* -
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* email:
* type: string
* format: email
* description: Email address of the user requesting password reset
* responses:
* '200':
* description: Password reset request processed
* content:
* application/json:
* schema:
* type: object
*/
router.post('/', checkPassportStrategyMiddleware, validator.email, apiV3FormValidator, addActivity, async(req, res) => {
const { email } = req.body;
const locale = configManager.getConfig('crowi', 'app:globalLang');
Expand Down Expand Up @@ -103,6 +150,37 @@ module.exports = (crowi) => {
}
});

/**
* @swagger
*
* /forgot-password:
* put:
* summary: Reset password
* tags: [Users]
* security:
* -
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* newPassword:
* type: string
* format: password
* description: New password
* responses:
* '200':
* description: Password reset successful
* content:
* application/json:
* schema:
* type: object
* properties:
* userData:
* $ref: '#/components/schemas/User'
*/
// eslint-disable-next-line max-len
router.put('/', checkPassportStrategyMiddleware, injectResetOrderByTokenMiddleware, validator.password, apiV3FormValidator, addActivity, async(req, res) => {
const { passwordResetOrder } = req;
Expand Down

0 comments on commit c7b976e

Please sign in to comment.