Skip to content

Commit

Permalink
Newer users may not extend their session until seasoned. (#1906)
Browse files Browse the repository at this point in the history
* Also bump out limiter for captcha
* Plethora of bad actors today.

Post #944

Auto-merge
  • Loading branch information
Martii authored Dec 24, 2021
1 parent d3e174c commit f4f102a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ exports.extend = function (aReq, aRes, aNext) {
}, function (aErr, aUser) {
// WARNING: No err handling

if (aUser._probationary) {
statusCodePage(aReq, aRes, aNext, {
statusCode: 403,
statusMessage: 'Newer users may not extend their session.'
});
return;
}

extendSession(aReq, aUser, function (aErr) {
if (aErr) {
if (aErr === 'Already extended') {
Expand Down
2 changes: 1 addition & 1 deletion libs/modifySessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ exports.getSessionDataList = function (aReq, aOptions, aCallback) {
var oujsOptions = session.passport.oujsOptions;

session.showExtend = aReq.sessionID === oujsOptions.sid;
session.canExtend = !oujsOptions.extended;
session.canExtend = !oujsOptions.extended && !authedUser._probationary;
session.canDestroyOne = true; // TODO: Perhaps do some further conditionals

oujsOptions.remoteAddressMask = session.name === authedUser.name && !oujsOptions.authFrom
Expand Down
2 changes: 1 addition & 1 deletion routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var settings = require('./models/settings.json');

//--

var waitInstallMin = isDev ? 1 : 60;
var waitInstallMin = isDev ? 1 : 360;
var installLimiter = rateLimit({
store: (isDev ? undefined : new MongoStore({
uri: 'mongodb://127.0.0.1:27017/installLimiter',
Expand Down

0 comments on commit f4f102a

Please sign in to comment.