Skip to content

Commit

Permalink
Ensure session username is same casing (#1083)
Browse files Browse the repository at this point in the history
* This goes back to when I first came into the project and noticed that `marti` and `Marti` were inconsistent in script access
* Added in a WARNING note for no error handling again

Auto-merge

Applies to #83 and #180 / #130 / #130 (comment)
  • Loading branch information
Martii authored Apr 15, 2017
1 parent 47de3d8 commit 55e2f4c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,16 @@ exports.auth = function (aReq, aRes, aNext) {

User.findOne({ name: { $regex: new RegExp('^' + username + '$', 'i') } },
function (aErr, aUser) {
// WARNING: No error handling at this stage
var strategies = null;
var strat = null;

if (aUser) {
// Ensure that casing is identical so we still have it, correctly, when they
// get back from authentication
if (aUser.name !== username) {
aReq.session.username = aUser.name;
}
strategies = aUser.strategies;
strat = strategies.pop();

Expand Down

0 comments on commit 55e2f4c

Please sign in to comment.