Skip to content

Commit

Permalink
Limit username length (OpenUserJS#1769)
Browse files Browse the repository at this point in the history
* This prevents some flooding
* Can tweak this a little bit but we'll see
* Checked with `db.users.find({$where:'this.name.length > 65'}).pretty();`

Auto-merge
  • Loading branch information
Martii authored Oct 17, 2020
1 parent 132efb6 commit 2a830dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ exports.auth = function (aReq, aRes, aNext) {
return;
}

if (username.length > 64) {
aRes.redirect('/login?toolong');
return;
}

// Store the username in the session so we still have it when they
// get back from authentication
if (!aReq.session.username) {
Expand Down

0 comments on commit 2a830dd

Please sign in to comment.