Skip to content
Permalink
1231f36974
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
40 lines (34 sloc) 1.25 KB
import express from "express";
// import cfg from "config";
import User from "../models/user.js";
// const mode = process.env.NODE_ENV || "dev";
// const config = cfg.get(mode);
const router = express.Router();
router.post("/registration", async (req, res) => {
const { email, registrationTimings } = req.body;
try {
await User.findOneAndUpdate({ email: email }, { registrationTimings: registrationTimings });
return res.status(200).json({ status: "Success" });
} catch (err) {
return res.status(500).json({ error: "Server error: " + err });
}
});
router.post("/fido2-authentication", async (req, res) => {
const { email, fido2AuthTimings } = req.body;
try {
await User.findOneAndUpdate({ email: email }, { fido2AuthTimings });
return res.status(200).json({ status: "Success" });
} catch (err) {
return res.status(500).json({ error: "Server error: " + err });
}
});
router.post("/pw-authentication", async (req, res) => {
const { email, passwordAuthTimings } = req.body;
try {
await User.findOneAndUpdate({ email: email }, { passwordAuthTimings });
return res.status(200).json({ status: "Success" });
} catch (err) {
return res.status(500).json({ error: "Server error: " + err });
}
});
export default router;