Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newer users may not extend their session until seasoned. #1906

Merged
merged 1 commit into from
Dec 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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