Update to version sharelatex version 3.0.1. Tested changes with our small experimental environment: Seems to work with the applied small fixes.

This commit is contained in:
Simon M. Haller-Seeber 2022-01-13 15:29:43 +01:00
parent 39ef130adc
commit 41c172b587
3 changed files with 41 additions and 38 deletions

View file

@ -1,4 +1,4 @@
FROM sharelatex/sharelatex:2.6.1 FROM sharelatex/sharelatex:3.0.1
# FROM sharelatex/sharelatex:latest # FROM sharelatex/sharelatex:latest
# latest might not be tested # latest might not be tested
# e.g. the AuthenticationManager.js script had to be adapted after versions 2.3.1 # e.g. the AuthenticationManager.js script had to be adapted after versions 2.3.1
@ -41,7 +41,8 @@ RUN sed -iE '/email@example.com/{n;N;N;d}' /var/www/sharelatex/web/app/views/use
RUN sed -iE "s/email@example.com/${login_text:-user}/g" /var/www/sharelatex/web/app/views/user/login.pug RUN sed -iE "s/email@example.com/${login_text:-user}/g" /var/www/sharelatex/web/app/views/user/login.pug
# Collaboration settings display (share project placeholder) | edit line 146 # Collaboration settings display (share project placeholder) | edit line 146
RUN sed -iE "s%placeholder=.*$%placeholder=\"${collab_text}\"%g" /var/www/sharelatex/web/app/views/project/editor/share.pug ### Lets see what the differeneces are 01/22
# RUN sed -iE "s%placeholder=.*$%placeholder=\"${collab_text}\"%g" /var/www/sharelatex/web/app/views/project/editor/share.pug
# extend pdflatex with option shell-esacpe ( fix for closed overleaf/overleaf/issues/217 and overleaf/docker-image/issues/45 ) # extend pdflatex with option shell-esacpe ( fix for closed overleaf/overleaf/issues/217 and overleaf/docker-image/issues/45 )
# do this in different ways for different sharelatex versions # do this in different ways for different sharelatex versions

View file

@ -1,11 +1,11 @@
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const { User } = require('../../models/User') const { User } = require('../../models/User')
const { db, ObjectId } = require('../../infrastructure/mongodb') const { db, ObjectId } = require('../../infrastructure/mongodb')
const bcrypt = require('bcrypt') const bcrypt = require('bcrypt')
const EmailHelper = require('../Helpers/EmailHelper') const EmailHelper = require('../Helpers/EmailHelper')
const { const {
InvalidEmailError, InvalidEmailError,
InvalidPasswordError InvalidPasswordError,
} = require('./AuthenticationErrors') } = require('./AuthenticationErrors')
const util = require('util') const util = require('util')
@ -127,7 +127,7 @@ const AuthenticationManager = {
if (password == null) { if (password == null) {
return new InvalidPasswordError({ return new InvalidPasswordError({
message: 'password not set', message: 'password not set',
info: { code: 'not_set' } info: { code: 'not_set' },
}) })
} }
@ -151,13 +151,13 @@ const AuthenticationManager = {
if (password.length < min) { if (password.length < min) {
return new InvalidPasswordError({ return new InvalidPasswordError({
message: 'password is too short', message: 'password is too short',
info: { code: 'too_short' } info: { code: 'too_short' },
}) })
} }
if (password.length > max) { if (password.length > max) {
return new InvalidPasswordError({ return new InvalidPasswordError({
message: 'password is too long', message: 'password is too long',
info: { code: 'too_long' } info: { code: 'too_long' },
}) })
} }
if ( if (
@ -166,7 +166,7 @@ const AuthenticationManager = {
) { ) {
return new InvalidPasswordError({ return new InvalidPasswordError({
message: 'password contains an invalid character', message: 'password contains an invalid character',
info: { code: 'invalid_character' } info: { code: 'invalid_character' },
}) })
} }
return null return null
@ -192,7 +192,7 @@ const AuthenticationManager = {
}, },
hashPassword(password, callback) { hashPassword(password, callback) {
bcrypt.genSalt(BCRYPT_ROUNDS, BCRYPT_MINOR_VERSION, function(error, salt) { bcrypt.genSalt(BCRYPT_ROUNDS, BCRYPT_MINOR_VERSION, function (error, salt) {
if (error) { if (error) {
return callback(error) return callback(error)
} }
@ -210,23 +210,23 @@ const AuthenticationManager = {
if (validationError) { if (validationError) {
return callback(validationError) return callback(validationError)
} }
this.hashPassword(password, function(error, hash) { this.hashPassword(password, function (error, hash) {
if (error) { if (error) {
return callback(error) return callback(error)
} }
db.users.updateOne( db.users.updateOne(
{ {
_id: ObjectId(user._id.toString()) _id: ObjectId(user._id.toString()),
}, },
{ {
$set: { $set: {
hashedPassword: hash hashedPassword: hash,
}, },
$unset: { $unset: {
password: true password: true,
}
}, },
function(updateError, result) { },
function (updateError, result) {
if (updateError) { if (updateError) {
return callback(updateError) return callback(updateError)
} }
@ -383,7 +383,7 @@ const AuthenticationManager = {
AuthenticationManager.promises = { AuthenticationManager.promises = {
authenticate: util.promisify(AuthenticationManager.authenticate), authenticate: util.promisify(AuthenticationManager.authenticate),
hashPassword: util.promisify(AuthenticationManager.hashPassword), hashPassword: util.promisify(AuthenticationManager.hashPassword),
setUserPassword: util.promisify(AuthenticationManager.setUserPassword) setUserPassword: util.promisify(AuthenticationManager.setUserPassword),
} }
module.exports = AuthenticationManager module.exports = AuthenticationManager

View file

@ -14,6 +14,7 @@
*/ */
let ContactsController let ContactsController
const AuthenticationController = require('../Authentication/AuthenticationController') const AuthenticationController = require('../Authentication/AuthenticationController')
const SessionManager = require('../Authentication/SessionManager')
const ContactManager = require('./ContactManager') const ContactManager = require('./ContactManager')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
@ -22,11 +23,12 @@ const { Client } = require('ldapts');
module.exports = ContactsController = { module.exports = ContactsController = {
getContacts(req, res, next) { getContacts(req, res, next) {
const user_id = AuthenticationController.getLoggedInUserId(req) // const user_id = AuthenticationController.getLoggedInUserId(req)
return ContactManager.getContactIds(user_id, { limit: 50 }, function( const user_id = SessionManager.getLoggedInUserId(req.session)
error, return ContactManager.getContactIds(
contact_ids user_id,
) { { limit: 50 },
function (error, contact_ids) {
if (error != null) { if (error != null) {
return next(error) return next(error)
} }
@ -36,9 +38,9 @@ module.exports = ContactsController = {
email: 1, email: 1,
first_name: 1, first_name: 1,
last_name: 1, last_name: 1,
holdingAccount: 1 holdingAccount: 1,
}, },
function(error, contacts) { function (error, contacts) {
if (error != null) { if (error != null) {
return next(error) return next(error)
} }
@ -132,7 +134,7 @@ module.exports = ContactsController = {
email: contact.email || '', email: contact.email || '',
first_name: contact.first_name || '', first_name: contact.first_name || '',
last_name: contact.last_name || '', last_name: contact.last_name || '',
type: 'user' type: 'user',
}
} }
},
} }