Skip to content

Commit eb5abb6

Browse files
committed
Merge branch 'release-2.16.3' into release
2 parents 4457ff6 + 457941b commit eb5abb6

File tree

8 files changed

+22
-7
lines changed

8 files changed

+22
-7
lines changed

client/modules/IDE/hooks/useP5Version.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
88
// JSON.stringify([...document.querySelectorAll('._132722c7')].map(n => n.innerText), null, 2)
99
// TODO: use their API for this to grab these at build time?
1010
export const p5Versions = [
11+
'2.0.1',
1112
'2.0.0',
1213
'1.11.5',
1314
'1.11.4',

client/utils/reduxFormUtils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export function validateSettings(formProps) {
6262

6363
export function validateLogin(formProps) {
6464
const errors = {};
65-
if (!formProps.email) {
66-
errors.email = i18n.t('ReduxFormUtils.errorEmptyEmail');
65+
if (!formProps.email && !formProps.username) {
66+
errors.email = i18n.t('ReduxFormUtils.errorEmptyEmailorUserName');
6767
}
6868
if (!formProps.password) {
6969
errors.password = i18n.t('ReduxFormUtils.errorEmptyPassword');

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p5.js-web-editor",
3-
"version": "2.16.2",
3+
"version": "2.16.3",
44
"description": "The web editor for p5.js.",
55
"scripts": {
66
"clean": "rimraf dist",

server/config/passport.js

+11
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ passport.use(
5454
const isMatch = await user.comparePassword(password);
5555

5656
if (isMatch) {
57+
user.lastLoginTimestamp = Date.now();
58+
await user.save();
59+
5760
return done(null, user);
5861
} else { // eslint-disable-line
5962
return done(null, false, { msg: 'Invalid email or password' });
@@ -88,6 +91,8 @@ passport.use(
8891
}
8992

9093
keyDocument.lastUsedAt = Date.now();
94+
user.lastLoginTimestamp = Date.now();
95+
9196
await user.save();
9297
return done(null, user);
9398
} catch (err) {
@@ -140,6 +145,9 @@ passport.use(
140145
} else if (existingUser.banned) {
141146
return done(null, false, { msg: accountSuspensionMessage });
142147
}
148+
existingUser.lastLoginTimestamp = Date.now();
149+
await existingUser.save();
150+
143151
return done(null, existingUser);
144152
}
145153

@@ -239,6 +247,9 @@ passport.use(
239247
} else if (existingUser.banned) {
240248
return done(null, false, { msg: accountSuspensionMessage });
241249
}
250+
existingUser.lastLoginTimestamp = Date.now();
251+
await existingUser.save();
252+
242253
return done(null, existingUser);
243254
}
244255

server/models/user.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ const userSchema = new Schema(
8282
enum: ['none', 'essential', 'all'],
8383
default: 'none'
8484
},
85-
banned: { type: Boolean, default: false }
85+
banned: { type: Boolean, default: false },
86+
lastLoginTimestamp: { type: Date }
8687
},
8788
{ timestamps: true, usePushEach: true }
8889
);

server/server.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ app.use(
9494
name: 'sessionId',
9595
cookie: {
9696
httpOnly: true,
97-
secure: false
97+
secure: false,
98+
maxAge: 1000 * 60 * 60 * 24 * 28 // 4 weeks in milliseconds
9899
},
99100
store: new MongoStore({
100101
clientPromise,

translations/locales/en-US/translations.json

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@
334334
"ReduxFormUtils": {
335335
"errorInvalidEmail": "Please enter a valid email address",
336336
"errorEmptyEmail": "Please enter an email",
337+
"errorEmptyEmailorUserName": "Please enter an email or username",
337338
"errorPasswordMismatch": "Passwords must match",
338339
"errorEmptyPassword": "Please enter a password",
339340
"errorShortPassword": "Password must be at least 6 characters",

0 commit comments

Comments
 (0)