Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5472-user_passExpired
This commit is contained in:
commit
22e69e6e91
|
@ -1,26 +1,18 @@
|
||||||
FROM mariadb:10.7.5
|
FROM mariadb:10.7.7
|
||||||
|
|
||||||
ENV MYSQL_ROOT_PASSWORD root
|
ENV MYSQL_ROOT_PASSWORD root
|
||||||
ENV TZ Europe/Madrid
|
ENV TZ Europe/Madrid
|
||||||
ARG MOCKDATE=2001-01-01 11:00:00
|
ARG MOCKDATE=2001-01-01 11:00:00
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends curl ca-certificates \
|
|
||||||
&& curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | apt-key add - \
|
|
||||||
&& echo "deb http://apt.verdnatura.es/ jessie main" > /etc/apt/sources.list.d/vn.list \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y vn-mariadb \
|
|
||||||
&& apt-get purge -y --auto-remove curl ca-certificates \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY docker/docker.cnf /etc/mysql/conf.d/
|
COPY docker/docker.cnf /etc/mysql/conf.d/
|
||||||
COPY \
|
COPY \
|
||||||
|
docker/docker-start.sh \
|
||||||
docker/docker-init.sh \
|
docker/docker-init.sh \
|
||||||
docker/docker-temp-start.sh \
|
|
||||||
docker/docker-temp-stop.sh \
|
docker/docker-temp-stop.sh \
|
||||||
docker/docker-dump.sh \
|
docker/docker-dump.sh \
|
||||||
docker/docker-start.sh \
|
docker/docker-structure.sh \
|
||||||
|
docker/docker-fixtures.sh \
|
||||||
/usr/local/bin/
|
/usr/local/bin/
|
||||||
|
|
||||||
RUN mkdir /mysql-data \
|
RUN mkdir /mysql-data \
|
||||||
|
@ -31,26 +23,16 @@ WORKDIR /docker-boot
|
||||||
COPY \
|
COPY \
|
||||||
import-changes.sh \
|
import-changes.sh \
|
||||||
config.ini \
|
config.ini \
|
||||||
dump/mysqlPlugins.sql \
|
|
||||||
dump/structure.sql \
|
dump/structure.sql \
|
||||||
dump/mockDate.sql \
|
dump/mockDate.sql \
|
||||||
dump/dumpedFixtures.sql \
|
dump/dumpedFixtures.sql \
|
||||||
./
|
./
|
||||||
RUN gosu mysql docker-init.sh \
|
RUN sed -i -e 's/@mockDate/'"$MOCKDATE"'/g' mockDate.sql \
|
||||||
&& docker-dump.sh mysqlPlugins \
|
&& gosu mysql docker-structure.sh
|
||||||
&& docker-dump.sh structure \
|
|
||||||
&& sed -i -e 's/@mockDate/'"$MOCKDATE"'/g' mockDate.sql \
|
|
||||||
&& docker-dump.sh mockDate \
|
|
||||||
&& docker-dump.sh dumpedFixtures \
|
|
||||||
&& gosu mysql docker-temp-stop.sh
|
|
||||||
|
|
||||||
COPY changes ./changes
|
COPY changes ./changes
|
||||||
COPY dump/fixtures.sql ./
|
COPY dump/fixtures.sql ./
|
||||||
ARG STAMP=unknown
|
ARG STAMP=unknown
|
||||||
RUN gosu mysql docker-temp-start.sh \
|
RUN gosu mysql docker-fixtures.sh
|
||||||
&& ./import-changes.sh \
|
|
||||||
&& docker-dump.sh fixtures \
|
|
||||||
&& gosu mysql docker-temp-stop.sh
|
|
||||||
|
|
||||||
RUN echo "[INFO] -> Import finished" \
|
RUN echo "[INFO] -> Import finished" \
|
||||||
&& rm -rf /docker-boot
|
&& rm -rf /docker-boot
|
||||||
|
|
|
@ -5,3 +5,6 @@ CMD=mysqld
|
||||||
|
|
||||||
docker_setup_env "$CMD"
|
docker_setup_env "$CMD"
|
||||||
docker_temp_server_start "$CMD"
|
docker_temp_server_start "$CMD"
|
||||||
|
bash import-changes.sh
|
||||||
|
docker-dump.sh fixtures
|
||||||
|
docker_temp_server_stop
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. docker-init.sh
|
||||||
|
docker-dump.sh structure
|
||||||
|
docker-dump.sh mockDate
|
||||||
|
docker-dump.sh dumpedFixtures
|
||||||
|
. docker-temp-stop.sh
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
-- Import compiled functions
|
|
||||||
CREATE AGGREGATE FUNCTION minacum RETURNS INT SONAME 'minacum.so';
|
|
||||||
CREATE AGGREGATE FUNCTION multimax RETURNS INT SONAME 'multimax.so';
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('changePassword', {
|
Self.remoteMethod('changePassword', {
|
||||||
description: 'Changes the user password',
|
description: 'Changes the user password',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('Account setPassword()', () => {
|
describe('Account setPassword()', () => {
|
||||||
|
const ctx = {req: {accessToken: {userId: 9}}};
|
||||||
it('should throw an error when password does not meet requirements', async() => {
|
it('should throw an error when password does not meet requirements', async() => {
|
||||||
let req = models.Account.setPassword(1, 'insecurePass');
|
let req = models.Account.setPassword(ctx, 1, 'insecurePass');
|
||||||
|
|
||||||
await expectAsync(req).toBeRejected();
|
await expectAsync(req).toBeRejected();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update password when it passes requirements', async() => {
|
it('should update password when it passes requirements', async() => {
|
||||||
let req = models.Account.setPassword(1, 'Very$ecurePa22.');
|
let req = models.Account.setPassword(ctx, 1, 'Very$ecurePa22.');
|
||||||
|
|
||||||
await expectAsync(req).toBeResolved();
|
await expectAsync(req).toBeResolved();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Client setPassword', () => {
|
describe('Client setPassword', () => {
|
||||||
|
const ctx = {req: {accessToken: {userId: 9}}};
|
||||||
it('should throw an error the setPassword target is not just a client but a worker', async() => {
|
it('should throw an error the setPassword target is not just a client but a worker', async() => {
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await models.Client.setPassword(1, 't0pl3v3l.p455w0rd!');
|
await models.Client.setPassword(ctx, 1, 't0pl3v3l.p455w0rd!');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +18,7 @@ describe('Client setPassword', () => {
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await models.Client.setPassword(1101, 't0pl3v3l.p455w0rd!');
|
await models.Client.setPassword(ctx, 1101, 't0pl3v3l.p455w0rd!');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue