remove debugging stuff
This commit is contained in:
+1
-3
@@ -9,7 +9,7 @@ export class RestAuth {
|
||||
public createRouter() {
|
||||
const router = express.Router();
|
||||
|
||||
router.put("/register", async (req, res) => {
|
||||
router.post("/register", async (req, res) => {
|
||||
const username = req.body.username;
|
||||
const timezone = req.body.timezone;
|
||||
const location = req.body.location;
|
||||
@@ -44,7 +44,6 @@ export class RestAuth {
|
||||
const password = req.body.password;
|
||||
const userService = await UserService.create();
|
||||
const user = await userService.getUserByName(username);
|
||||
console.log(user);
|
||||
|
||||
if (!user) {
|
||||
res.status(404).send({success: false, message: "User not found", id: "username"});
|
||||
@@ -58,7 +57,6 @@ export class RestAuth {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// generate JWT token here
|
||||
const jwtToken = new JwtAuthenticator(
|
||||
process.env.SECRET_KEY!,
|
||||
|
||||
@@ -12,6 +12,7 @@ export function authenticateJwt(
|
||||
const jwtAuthenticator = new JwtAuthenticator(
|
||||
process.env.SECRET_KEY as string,
|
||||
);
|
||||
|
||||
const decodedToken = jwtAuthenticator.verifyToken(token);
|
||||
if (!decodedToken) {
|
||||
return res.status(401).send("Unauthorized");
|
||||
|
||||
@@ -25,7 +25,6 @@ export class RestUser {
|
||||
});
|
||||
|
||||
router.put("/:id", async (req, res) => {
|
||||
console.log("PUT /user/:id")
|
||||
const userService = await UserService.create();
|
||||
const id = req.params.id;
|
||||
const user = req.body as IUser;
|
||||
|
||||
Reference in New Issue
Block a user