1) added html regex
2) added welcome user
3) change forgotpassword and resetpassword to ejs
This commit is contained in:
newtbot
2024-01-21 21:06:10 +08:00
parent a749d91425
commit 877eaeae43
26 changed files with 2630 additions and 5320 deletions

View File

@ -6,7 +6,6 @@ const router = express.Router();
// /user/register
router.post("/register", async (req, res, next) => {
try {
console.log(req.body);
let Res = await addUser(req.body);
if (Res == false) {
let error = new Error("UserRegFailed");
@ -36,7 +35,6 @@ router.post("/login", async (req, res, next) => {
}
else{
//pass res back to form to be set in local storage
console.log("my res" , Res);
return res.json({
message: "User login successfully",
token: Res.token,
@ -51,6 +49,12 @@ router.post("/login", async (req, res, next) => {
}
});
//contact
//auth/contact
router.post("/contact", async (req, res, next) => {
});
module.exports = router;

View File

@ -67,8 +67,8 @@ router.get("/profile", function (req, res, next) {
});
//forgot password page
router.get("/forgotPassword", function (req, res, next) {
res.render("forgotPassword");
router.get("/forgotpassword", function (req, res, next) {
res.render("forgotpassword");
});
//contact page

View File

@ -7,8 +7,6 @@ const router = express.Router();
//getbyid
router.get("/me", async function (req, res, next) {
try {
//console.log(req.user);
let user = await getUserID(req.user);
if (!user) {
let error = new Error("User not found");
@ -24,6 +22,7 @@ router.get("/me", async function (req, res, next) {
}
});
//logout
router.delete('/logout', async function(req, res, next){
try{