Skip to content

Commit

Permalink
quickfix for auth middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
o-bm committed Apr 6, 2024
1 parent 3329d49 commit 6af913c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions server/controllers/ChallengeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function formatChallenge(challengeData) {


exports.findSuggested = async (req, res) => {
console.log(req.user)
const username = req.user.username;
// see how many solutions the user has solved
const userSolutions = await db.Solution.findAll({
Expand Down
4 changes: 2 additions & 2 deletions server/controllers/UserController.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const db = require("../models/index");
const User = db.User;

//change
exports.getMe = async (req, res) => {
res.status(200).json({ username: req.user.username });
res.status(200).json({ username: req.headers.utorid });
};

exports.get = async (req, res) => {
Expand Down
2 changes: 1 addition & 1 deletion server/middleware/AuthenticationMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const db = require("../models");
const { HandledError } = require("./ErrorHandlingMiddleware");

async function authMiddleware(req, res, next) {
next();
try {
const utorid = req.headers.utorid;
const http_mail = req.headers.http_mail;
Expand All @@ -18,6 +17,7 @@ async function authMiddleware(req, res, next) {
}

req.user = user;
console.log(user);
next();
} catch (error) {
next(new HandledError(500, "Shibboleth headers not found."));
Expand Down

0 comments on commit 6af913c

Please sign in to comment.