Compare commits

..

No commits in common. "1871f3f96aab5c0af2e4b2ef2815ca0b098ed97e" and "46c81471721a6259b0004b18e622f53075f00ba9" have entirely different histories.

3 changed files with 27 additions and 40 deletions

View File

@ -1,40 +1,35 @@
const router = require("express").Router();
const router = require('express').Router();
router.get("/users", (request, response) => {
response.send(require("./json/users/users.json"));
});
response.send(require("./json/users/users.json"))
})
router.post("/auth", (request, response) => {
const { phoneNumber, password } = request.body;
console.log(phoneNumber, password);
if (phoneNumber === "89999999999") {
response.send(require("./json/auth/dogsitter.success.json"));
} else if (phoneNumber === "89555555555") {
response.status(400).send(require("./json/auth/error.json"));
} else {
response.send(require("./json/auth/owner.success.json"));
}
});
router.post("/auth/2fa", (request, response) => {
const { code } = request.body;
if (code === "0000") {
response.send(require("./json/2fa/success.json"));
} else {
response.status(400).send(require("./json/2fa/error.json"));
}
});
const {phoneNumber, password} = request.body;
console.log(phoneNumber, password);
if (phoneNumber === '89999999999') {
response.send(require("./json/auth/dogsitter.success.json"))
}
else if (phoneNumber === '89555555555') {
response.status(400).send(require("./json/auth/error.json"))
}
else {
response.send(require("./json/auth/owner.success.json"))
}
})
router.post("/register", (request, response) => {
const { firstName, secondName, phoneNumber, password, role } = request.body;
console.log(phoneNumber, password, role);
if (phoneNumber === "89283244141" || phoneNumber === "89872855893") {
response.status(400).send(require("./json/register/error.json"));
} else if (role === "dogsitter") {
response.send(require("./json/register/dogsitter.success.json"));
} else {
response.send(require("./json/register/owner.success.json"));
}
});
const {firstName, secondName, phoneNumber, password, role} = request.body;
console.log(phoneNumber, password, role);
if (phoneNumber === '89283244141' || phoneNumber === '89872855893') {
response.status(400).send(require("./json/register/error.json"))
}
else if (role === 'dogsitter') {
response.send(require("./json/register/dogsitter.success.json"))
}
else {
response.send(require("./json/register/owner.success.json"))
}
})
module.exports = router;

View File

@ -1,4 +0,0 @@
{
"status": "error",
"message": "Invalid code."
}

View File

@ -1,4 +0,0 @@
{
"status": "success",
"message": "Two-factor authentication passed."
}