mirror of
https://github.com/detleph/server.git
synced 2026-09-05 23:44:18 +02:00
Restructure the process of changing a password
+ Requests are now dispatched to the according user ressource, not the collection + The current user can be referenced by setting the pid to 'current' + Refactored the error logic
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import express from "express";
|
||||
import { getAllAdmins, createAdmin, updatePassword } from "../Controllers/admin.controller";
|
||||
import { getAllAdmins, createAdmin, updateOwnPassword, updateForeignPassword } from "../Controllers/admin.controller";
|
||||
import { requireAuthentication } from "../Middleware/auth/auth";
|
||||
|
||||
const router = express.Router();
|
||||
@@ -8,7 +8,7 @@ router.get("/", requireAuthentication, getAllAdmins);
|
||||
|
||||
router.post("/", requireAuthentication, createAdmin);
|
||||
|
||||
// TODO: Use URL parameters to specify the user to update
|
||||
router.put("/password", requireAuthentication, updatePassword);
|
||||
router.put("/current/password", requireAuthentication, updateOwnPassword);
|
||||
router.put<"/:pid/password", { pid: string }>("/:pid/password", requireAuthentication, updateForeignPassword);
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user