Skip to content

Commit

Permalink
Ensure session username is same casing
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

Applies to OpenUserJS#83 and OpenUserJS#180 / OpenUserJS#130 / OpenUserJS#130 (comment)
  • Loading branch information
Martii committed Apr 15, 2017
1 parent 47de3d8 commit ef93bfd
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 ef93bfd

Please sign in to comment.