mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Hotfix 2.5.2 (#831)
This commit is contained in:
parent
8747b5c4e2
commit
2594122fef
3 changed files with 47 additions and 0 deletions
28
server-ce/hotfix/2.5.2/12_update_token_email.js
Normal file
28
server-ce/hotfix/2.5.2/12_update_token_email.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const Settings = require('settings-sharelatex')
|
||||
const mongojs = require('mongojs')
|
||||
const db = mongojs(Settings.mongo.url, ['tokens'])
|
||||
const async = require('async')
|
||||
|
||||
exports.migrate = (client, done) => {
|
||||
console.log(`>> Updating 'data.email' to lower case in tokens`)
|
||||
|
||||
db.tokens.find({}, { 'data.email': 1 }, (err, tokens) => {
|
||||
if (err) {
|
||||
return done(err)
|
||||
}
|
||||
|
||||
async.eachSeries(
|
||||
tokens,
|
||||
(token, callback) => {
|
||||
db.tokens.update(
|
||||
{ _id: token._id },
|
||||
{ $set: { 'data.email': token.data.email.toLowerCase() } },
|
||||
callback
|
||||
)
|
||||
},
|
||||
done
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
exports.rollback = (client, done) => done()
|
8
server-ce/hotfix/2.5.2/Dockerfile
Normal file
8
server-ce/hotfix/2.5.2/Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
|||
FROM sharelatex/sharelatex:2.5.1
|
||||
|
||||
# Patch: fixes registration token creation
|
||||
COPY create-token-lowercase-email.patch ${baseDir}
|
||||
RUN cd ${baseDir} && patch -p0 < create-token-lowercase-email.patch
|
||||
|
||||
# Migration for tokens with invalid email addresses
|
||||
ADD 12_update_token_email.js /var/www/sharelatex/migrations/12_update_token_email.js
|
11
server-ce/hotfix/2.5.2/create-token-lowercase-email.patch
Normal file
11
server-ce/hotfix/2.5.2/create-token-lowercase-email.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- /var/www/sharelatex/web/app/src/Features/User/UserRegistrationHandler.js
|
||||
+++ /var/www/sharelatex/web/app/src/Features/User/UserRegistrationHandler.js
|
||||
@@ -122,7 +122,7 @@ const UserRegistrationHandler = {
|
||||
const ONE_WEEK = 7 * 24 * 60 * 60 // seconds
|
||||
OneTimeTokenHandler.getNewToken(
|
||||
'password',
|
||||
- { user_id: user._id.toString(), email },
|
||||
+ { user_id: user._id.toString(), email: user.email },
|
||||
{ expiresIn: ONE_WEEK },
|
||||
(err, token) => {
|
||||
if (err != null) {
|
Loading…
Reference in a new issue