All files / src/routes/root_routes forgetPassword_post.js

77.77% Statements 7/9
75% Branches 3/4
100% Functions 1/1
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24              3x   1x 1x     1x 1x     1x 1x          
import forgetPassword_sendVerificationCode_post from "./forgetPassword_sendVerificationCode_post.js";
import forgetPassword_receiveVerificationCode_post from "./forgetPassword_receiveVerificationCode_post.js";
import forgetPassword_changePassword_post from "./forgetPassword_changePassword_post.js";
import asyncRouteHandler from "../../utilities/asyncRouteHandler.js";
 
export default asyncRouteHandler(
    async function forgetPassword_post(req, res, next) {
        switch (req.query.type) {
            case "changing-password-request": {
                forgetPassword_sendVerificationCode_post(req, res, next);
                break;
            }
            case "proving-email-ownership": {
                forgetPassword_receiveVerificationCode_post(req, res);
                break;
            }
            case "complete-changing-password": {
                forgetPassword_changePassword_post(req, res);
                break;
            }
            default: res.status(400).json(); break;
        }
    }
)