Skip to content

Commit

Permalink
add manuel user verification
Browse files Browse the repository at this point in the history
  • Loading branch information
birdpump committed Aug 8, 2024
1 parent d520ee8 commit a81762d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions controllers/admin/adminData.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ export async function manualCreateUser(data) {
}
}

export async function manualVerifyUser(studentId) {
let student = await UserData.findByPk(studentId);
await createUser(student.studentId, student.name, student.grade, student.permissions, student.email);
}

//todo this doesnt work, gives an error
export async function clearLockerDB(data) {
if (data.areYouSure) {
Expand Down
13 changes: 10 additions & 3 deletions routes/admin/adminData.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getLockersDB,
getUserEditData,
getUsersDB,
manualCreateUser,
manualCreateUser, manualVerifyUser,
queryAreaRestriction,
queryGradeRestriction,
queryStats,
Expand All @@ -34,8 +34,6 @@ export const adminRouter = express.Router();

adminRouter.use(ensureAuthenticated);

adminRouter.use('/data', express.static(path.join(__dirname, 'data-temp')));


adminRouter.post('/management/grade-restrictions', async (req, res) => {
const data = req.body;
Expand Down Expand Up @@ -197,6 +195,15 @@ adminRouter.post('/manual/create-user', async (req, res, next) => {
next(error);
}
});
adminRouter.post('/manual/verify-user/:studentId', async (req, res, next) => {
const studentId = req.params.studentId;
try {
await manualVerifyUser(studentId);
res.sendStatus(200);
} catch (error) {
next(error);
}
});


adminRouter.post('/db-action/clear-lockers', async (req, res, next) => {
Expand Down

0 comments on commit a81762d

Please sign in to comment.