Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
111 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters