mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bcb4c6d7b0
@ -4,7 +4,7 @@ language: java
|
|||||||
before_install:
|
before_install:
|
||||||
- sudo add-apt-repository -y ppa:mc3man/trusty-media
|
- sudo add-apt-repository -y ppa:mc3man/trusty-media
|
||||||
- sudo apt-get -qq update
|
- sudo apt-get -qq update
|
||||||
- sudo apt-get -y -q install ffmpeg mediainfo tesseract-ocr tesseract-ocr-fra tesseract-ocr-ita tesseract-ocr-kor tesseract-ocr-rus tesseract-ocr-ukr tesseract-ocr-spa tesseract-ocr-ara tesseract-ocr-hin tesseract-ocr-deu tesseract-ocr-pol tesseract-ocr-jpn tesseract-ocr-por tesseract-ocr-tha tesseract-ocr-jpn tesseract-ocr-chi-sim tesseract-ocr-chi-tra tesseract-ocr-nld tesseract-ocr-tur tesseract-ocr-heb tesseract-ocr-hun tesseract-ocr-fin tesseract-ocr-swe tesseract-ocr-lav tesseract-ocr-dan
|
- sudo apt-get -y -q install ffmpeg mediainfo tesseract-ocr tesseract-ocr-fra tesseract-ocr-ita tesseract-ocr-kor tesseract-ocr-rus tesseract-ocr-ukr tesseract-ocr-spa tesseract-ocr-ara tesseract-ocr-hin tesseract-ocr-deu tesseract-ocr-pol tesseract-ocr-jpn tesseract-ocr-por tesseract-ocr-tha tesseract-ocr-jpn tesseract-ocr-chi-sim tesseract-ocr-chi-tra tesseract-ocr-nld tesseract-ocr-tur tesseract-ocr-heb tesseract-ocr-hun tesseract-ocr-fin tesseract-ocr-swe tesseract-ocr-lav tesseract-ocr-dan tesseract-ocr-nor
|
||||||
- sudo apt-get -y -q install haveged && sudo service haveged start
|
- sudo apt-get -y -q install haveged && sudo service haveged start
|
||||||
after_success:
|
after_success:
|
||||||
- |
|
- |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
FROM sismics/ubuntu-jetty:9.4.12-2
|
FROM sismics/ubuntu-jetty:9.4.12-2
|
||||||
MAINTAINER b.gamard@sismics.com
|
MAINTAINER b.gamard@sismics.com
|
||||||
|
|
||||||
RUN apt-get update && apt-get -y -q install ffmpeg mediainfo tesseract-ocr tesseract-ocr-fra tesseract-ocr-ita tesseract-ocr-kor tesseract-ocr-rus tesseract-ocr-ukr tesseract-ocr-spa tesseract-ocr-ara tesseract-ocr-hin tesseract-ocr-deu tesseract-ocr-pol tesseract-ocr-jpn tesseract-ocr-por tesseract-ocr-tha tesseract-ocr-jpn tesseract-ocr-chi-sim tesseract-ocr-chi-tra tesseract-ocr-nld tesseract-ocr-tur tesseract-ocr-heb tesseract-ocr-hun tesseract-ocr-fin tesseract-ocr-swe tesseract-ocr-lav tesseract-ocr-dan && \
|
RUN apt-get update && apt-get -y -q install ffmpeg mediainfo tesseract-ocr tesseract-ocr-fra tesseract-ocr-ita tesseract-ocr-kor tesseract-ocr-rus tesseract-ocr-ukr tesseract-ocr-spa tesseract-ocr-ara tesseract-ocr-hin tesseract-ocr-deu tesseract-ocr-pol tesseract-ocr-jpn tesseract-ocr-por tesseract-ocr-tha tesseract-ocr-jpn tesseract-ocr-chi-sim tesseract-ocr-chi-tra tesseract-ocr-nld tesseract-ocr-tur tesseract-ocr-heb tesseract-ocr-hun tesseract-ocr-fin tesseract-ocr-swe tesseract-ocr-lav tesseract-ocr-dan tesseract-ocr-nor && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Remove the embedded javax.mail jar from Jetty
|
# Remove the embedded javax.mail jar from Jetty
|
||||||
|
@ -74,6 +74,7 @@ To build external URL, the server is expecting a `DOCS_BASE_URL` environment var
|
|||||||
- General
|
- General
|
||||||
- `DOCS_BASE_URL`: The base url used by the application. Generated url's will be using this as base.
|
- `DOCS_BASE_URL`: The base url used by the application. Generated url's will be using this as base.
|
||||||
- `DOCS_GLOBAL_QUOTA`: Defines the default quota applying to all users.
|
- `DOCS_GLOBAL_QUOTA`: Defines the default quota applying to all users.
|
||||||
|
- `DOCS_BCRYPT_WORK`: Defines the work factor which is used for password hashing. The default is `10`. This value may be `4...31` including `4` and `31`. The specified value will be used for all new users and users changing their password. Be aware that setting this factor to high can heavily impact login and user creation performance.
|
||||||
|
|
||||||
- Admin
|
- Admin
|
||||||
- `DOCS_ADMIN_EMAIL_INIT`: Defines the e-mail-address the admin user should have upon initialization.
|
- `DOCS_ADMIN_EMAIL_INIT`: Defines the e-mail-address the admin user should have upon initialization.
|
||||||
|
@ -25,6 +25,11 @@ public class Constants {
|
|||||||
*/
|
*/
|
||||||
public static final String DEFAULT_ADMIN_EMAIL = "admin@localhost";
|
public static final String DEFAULT_ADMIN_EMAIL = "admin@localhost";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bcrypt default work factor
|
||||||
|
*/
|
||||||
|
public static final int DEFAULT_BCRYPT_WORK = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guest user ID.
|
* Guest user ID.
|
||||||
*/
|
*/
|
||||||
@ -38,7 +43,7 @@ public class Constants {
|
|||||||
/**
|
/**
|
||||||
* Supported document languages.
|
* Supported document languages.
|
||||||
*/
|
*/
|
||||||
public static final List<String> SUPPORTED_LANGUAGES = Lists.newArrayList("eng", "fra", "ita", "deu", "spa", "por", "pol", "rus", "ukr", "ara", "hin", "chi_sim", "chi_tra", "jpn", "tha", "kor", "nld", "tur", "heb", "hun", "fin", "swe", "lav", "dan");
|
public static final List<String> SUPPORTED_LANGUAGES = Lists.newArrayList("eng", "fra", "ita", "deu", "spa", "por", "pol", "rus", "ukr", "ara", "hin", "chi_sim", "chi_tra", "jpn", "tha", "kor", "nld", "tur", "heb", "hun", "fin", "swe", "lav", "dan", "nor");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base URL environment variable.
|
* Base URL environment variable.
|
||||||
@ -73,6 +78,11 @@ public class Constants {
|
|||||||
*/
|
*/
|
||||||
public static final String ADMIN_EMAIL_INIT_ENV = "DOCS_ADMIN_EMAIL_INIT";
|
public static final String ADMIN_EMAIL_INIT_ENV = "DOCS_ADMIN_EMAIL_INIT";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Work factor to be used by Bcrypt
|
||||||
|
*/
|
||||||
|
public static final String BCRYPT_WORK_ENV = "DOCS_BCRYPT_WORK";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expiration time of the password recovery in hours.
|
* Expiration time of the password recovery in hours.
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package com.sismics.docs.core.dao;
|
package com.sismics.docs.core.dao;
|
||||||
|
|
||||||
import at.favre.lib.crypto.bcrypt.BCrypt;
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
import at.favre.lib.crypto.bcrypt.BCrypt;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.sismics.docs.core.constant.AuditLogType;
|
import com.sismics.docs.core.constant.AuditLogType;
|
||||||
|
import com.sismics.docs.core.constant.Constants;
|
||||||
import com.sismics.docs.core.dao.criteria.UserCriteria;
|
import com.sismics.docs.core.dao.criteria.UserCriteria;
|
||||||
import com.sismics.docs.core.dao.dto.UserDto;
|
import com.sismics.docs.core.dao.dto.UserDto;
|
||||||
import com.sismics.docs.core.model.jpa.User;
|
import com.sismics.docs.core.model.jpa.User;
|
||||||
@ -12,7 +17,6 @@ import com.sismics.docs.core.util.jpa.QueryParam;
|
|||||||
import com.sismics.docs.core.util.jpa.QueryUtil;
|
import com.sismics.docs.core.util.jpa.QueryUtil;
|
||||||
import com.sismics.docs.core.util.jpa.SortCriteria;
|
import com.sismics.docs.core.util.jpa.SortCriteria;
|
||||||
import com.sismics.util.context.ThreadLocalContext;
|
import com.sismics.util.context.ThreadLocalContext;
|
||||||
import org.joda.time.DateTime;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
@ -26,6 +30,11 @@ import java.util.*;
|
|||||||
* @author jtremeaux
|
* @author jtremeaux
|
||||||
*/
|
*/
|
||||||
public class UserDao {
|
public class UserDao {
|
||||||
|
/**
|
||||||
|
* Logger.
|
||||||
|
*/
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(UserDao.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authenticates an user.
|
* Authenticates an user.
|
||||||
*
|
*
|
||||||
@ -278,7 +287,21 @@ public class UserDao {
|
|||||||
* @return Hashed password
|
* @return Hashed password
|
||||||
*/
|
*/
|
||||||
private String hashPassword(String password) {
|
private String hashPassword(String password) {
|
||||||
return BCrypt.withDefaults().hashToString(10, password.toCharArray());
|
int bcryptWork = Constants.DEFAULT_BCRYPT_WORK;
|
||||||
|
String envBcryptWork = System.getenv(Constants.BCRYPT_WORK_ENV);
|
||||||
|
if (envBcryptWork != null) {
|
||||||
|
try {
|
||||||
|
int envBcryptWorkInt = Integer.parseInt(envBcryptWork);
|
||||||
|
if (envBcryptWorkInt >= 4 && envBcryptWorkInt <= 31) {
|
||||||
|
bcryptWork = envBcryptWorkInt;
|
||||||
|
} else {
|
||||||
|
log.warn(Constants.BCRYPT_WORK_ENV + " needs to be in range 4...31. Falling back to " + Constants.DEFAULT_BCRYPT_WORK + ".");
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
log.warn(Constants.BCRYPT_WORK_ENV + " needs to be a number in range 4...31. Falling back to " + Constants.DEFAULT_BCRYPT_WORK + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BCrypt.withDefaults().hashToString(bcryptWork, password.toCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@ RUN npm install && npm install -g pkg
|
|||||||
RUN pkg -t node14-alpine-x64 .
|
RUN pkg -t node14-alpine-x64 .
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
ENV TEEDY_TAG= TEEDY_ADDTAGS=false TEEDY_LANG=eng TEEDY_URL='http://localhost:8080' TEEDY_USERNAME=username TEEDY_PASSWORD=password TEEDY_COPYFOLDER= TEEDY_FILEFILTER=
|
ENV TEEDY_TAG= TEEDY_ADDTAGS=false TEEDY_LANG=eng TEEDY_URL='http://localhost:8080' TEEDY_USERNAME=username TEEDY_PASSWORD=password TEEDY_COPYFOLDER= TEEDY_FILEFILTER=*
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
libc6-compat \
|
libc6-compat \
|
||||||
libstdc++
|
libstdc++
|
||||||
|
@ -540,7 +540,8 @@ angular.module('docs',
|
|||||||
{ key: 'fin', label: 'Suomi' },
|
{ key: 'fin', label: 'Suomi' },
|
||||||
{ key: 'swe', label: 'Svenska' },
|
{ key: 'swe', label: 'Svenska' },
|
||||||
{ key: 'lav', label: 'Latviešu' },
|
{ key: 'lav', label: 'Latviešu' },
|
||||||
{ key: 'dan', label: 'Dansk' }
|
{ key: 'dan', label: 'Dansk' },
|
||||||
|
{ key: 'nor', label: 'Norsk' }
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user