Update dependencies
This commit is contained in:
parent
1158db6d7e
commit
5a7e695e53
10 changed files with 864 additions and 870 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
|
@ -20,7 +20,7 @@ export default async (ctx, next) => {
|
||||||
const userToken = await ctx.redis.get(ctx.req.headers.authorization.substr(1));
|
const userToken = await ctx.redis.get(ctx.req.headers.authorization.substr(1));
|
||||||
ctx.assert(userToken, 401, '{"error": {"message": "Invalid token.", "code": 606}}');
|
ctx.assert(userToken, 401, '{"error": {"message": "Invalid token.", "code": 606}}');
|
||||||
debug('Token found');
|
debug('Token found');
|
||||||
user = await models.user.findById(userToken);
|
user = await models.user.findByPk(userToken);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
login.save();
|
login.save();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -29,7 +29,7 @@ export async function create(ctx) {
|
||||||
|
|
||||||
delete customer.subscriptions;
|
delete customer.subscriptions;
|
||||||
|
|
||||||
const user = await models.user.findById(ctx.user.id);
|
const user = await models.user.findByPk(ctx.user.id);
|
||||||
user.plan = 'Pro';
|
user.plan = 'Pro';
|
||||||
await user.save();
|
await user.save();
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ export async function create(ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function cancel(ctx) {
|
export async function cancel(ctx) {
|
||||||
const user = await models.user.findById(ctx.user.id);
|
const user = await models.user.findByPk(ctx.user.id);
|
||||||
const transactions = await user.getTransactions();
|
const transactions = await user.getTransactions();
|
||||||
const transaction = transactions[0];
|
const transaction = transactions[0];
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ export async function settings(ctx) {
|
||||||
ctx.request.body.current_password, 400,
|
ctx.request.body.current_password, 400,
|
||||||
'{"error": {"message": "Current Password required to update account.", "code": 612}}',
|
'{"error": {"message": "Current Password required to update account.", "code": 612}}',
|
||||||
);
|
);
|
||||||
const user = await models.user.findById(ctx.user.id);
|
const user = await models.user.findByPk(ctx.user.id);
|
||||||
ctx.assert(
|
ctx.assert(
|
||||||
await passwords.match(ctx.request.body.current_password, user.password), 400,
|
await passwords.match(ctx.request.body.current_password, user.password), 400,
|
||||||
'{"error": {"message": "Incorrect password", "code": 606}}',
|
'{"error": {"message": "Incorrect password", "code": 606}}',
|
||||||
|
|
|
@ -25,7 +25,7 @@ services:
|
||||||
VIRUSTOTAL_KEY:
|
VIRUSTOTAL_KEY:
|
||||||
SENTRY_DSN:
|
SENTRY_DSN:
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app:cached
|
- ./:/app
|
||||||
- uploads:/hostr/uploads
|
- uploads:/hostr/uploads
|
||||||
- export:/export
|
- export:/export
|
||||||
ports:
|
ports:
|
||||||
|
@ -55,7 +55,7 @@ services:
|
||||||
VIRUSTOTAL_KEY:
|
VIRUSTOTAL_KEY:
|
||||||
SENTRY_DSN:
|
SENTRY_DSN:
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app:cached
|
- ./:/app
|
||||||
- uploads:/hostr/uploads
|
- uploads:/hostr/uploads
|
||||||
ports:
|
ports:
|
||||||
- "3001:3000"
|
- "3001:3000"
|
||||||
|
|
|
@ -14,7 +14,7 @@ async function checkId(Files, fileId, attempts) {
|
||||||
if (attempts > 10) {
|
if (attempts > 10) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const file = await models.file.findById(fileId);
|
const file = await models.file.findByPk(fileId);
|
||||||
if (file === null) {
|
if (file === null) {
|
||||||
return fileId;
|
return fileId;
|
||||||
}
|
}
|
||||||
|
|
10
package.json
10
package.json
|
@ -25,7 +25,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sendgrid/mail": "^6.3.1",
|
"@sendgrid/mail": "^6.3.1",
|
||||||
"@sentry/node": "^4.5.3",
|
"@sentry/node": "^5.4.0",
|
||||||
"angular": "^1.7.7",
|
"angular": "^1.7.7",
|
||||||
"angular-reconnecting-websocket": "https://github.com/adieu/angular-reconnecting-websocket#0.1.1",
|
"angular-reconnecting-websocket": "https://github.com/adieu/angular-reconnecting-websocket#0.1.1",
|
||||||
"angular-resource": "^1.7.7",
|
"angular-resource": "^1.7.7",
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
"co": "~4.6.0",
|
"co": "~4.6.0",
|
||||||
"co-redis": "^2.1.0",
|
"co-redis": "^2.1.0",
|
||||||
"co-views": "~2.1.0",
|
"co-views": "~2.1.0",
|
||||||
"copy-webpack-plugin": "^4.6.0",
|
"copy-webpack-plugin": "^5.0.3",
|
||||||
"debug": "~4.1.1",
|
"debug": "~4.1.1",
|
||||||
"dropzone": "~5.5.1",
|
"dropzone": "~5.5.1",
|
||||||
"ejs": "^2.6.1",
|
"ejs": "^2.6.1",
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
"koa-generic-session": "^2.0.1",
|
"koa-generic-session": "^2.0.1",
|
||||||
"koa-helmet": "^4.0.0",
|
"koa-helmet": "^4.0.0",
|
||||||
"koa-logger": "~3.2.0",
|
"koa-logger": "~3.2.0",
|
||||||
"koa-redis": "^3.1.3",
|
"koa-redis": "^4.0.0",
|
||||||
"koa-router": "^7.4.0",
|
"koa-router": "^7.4.0",
|
||||||
"koa-session": "^5.10.1",
|
"koa-session": "^5.10.1",
|
||||||
"koa-static": "^5.0.0",
|
"koa-static": "^5.0.0",
|
||||||
|
@ -79,10 +79,10 @@
|
||||||
"passwords": "^1.3.1",
|
"passwords": "^1.3.1",
|
||||||
"pg": "^7.9.0",
|
"pg": "^7.9.0",
|
||||||
"redis": "^2.8.0",
|
"redis": "^2.8.0",
|
||||||
"sequelize": "^4.42.0",
|
"sequelize": "^5.8.7",
|
||||||
"smooth-scroll": "https://github.com/cferdinandi/smooth-scroll#5.3.7",
|
"smooth-scroll": "https://github.com/cferdinandi/smooth-scroll#5.3.7",
|
||||||
"statsy": "~0.2.0",
|
"statsy": "~0.2.0",
|
||||||
"stripe": "^6.23.1",
|
"stripe": "^7.1.0",
|
||||||
"webpack": "^4.29.3",
|
"webpack": "^4.29.3",
|
||||||
"webpack-cli": "^3.2.3",
|
"webpack-cli": "^3.2.3",
|
||||||
"zeroclipboard": "^2.2.0"
|
"zeroclipboard": "^2.2.0"
|
||||||
|
|
|
@ -183,24 +183,24 @@ Visit ${process.env.WEB_BASE_URL}/forgot/${reset.id} to set a new one.
|
||||||
|
|
||||||
export async function fromToken(token) {
|
export async function fromToken(token) {
|
||||||
const userId = await this.redis.get(token);
|
const userId = await this.redis.get(token);
|
||||||
return models.user.findById(userId);
|
return models.user.findByPk(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function fromCookie(rememberId) {
|
export async function fromCookie(rememberId) {
|
||||||
const userId = await models.remember.findById(rememberId);
|
const userId = await models.remember.findByPk(rememberId);
|
||||||
return models.user.findById(userId);
|
return models.user.findByPk(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function validateResetToken(resetId) {
|
export async function validateResetToken(resetId) {
|
||||||
return models.reset.findById(resetId);
|
return models.reset.findByPk(resetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function updatePassword(userId, password) {
|
export async function updatePassword(userId, password) {
|
||||||
const cryptedPassword = await passwords.crypt(password);
|
const cryptedPassword = await passwords.crypt(password);
|
||||||
const user = await models.user.findById(userId);
|
const user = await models.user.findByPk(userId);
|
||||||
user.password = cryptedPassword;
|
user.password = cryptedPassword;
|
||||||
await user.save();
|
await user.save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ export async function forgot(ctx) {
|
||||||
const user = await validateResetToken(token);
|
const user = await validateResetToken(token);
|
||||||
if (user) {
|
if (user) {
|
||||||
await updatePassword(user.userId, ctx.request.body.password);
|
await updatePassword(user.userId, ctx.request.body.password);
|
||||||
const reset = await models.reset.findById(token);
|
const reset = await models.reset.findByPk(token);
|
||||||
reset.destroy();
|
reset.destroy();
|
||||||
await setupSession.call(ctx, user);
|
await setupSession.call(ctx, user);
|
||||||
ctx.statsd.incr('auth.reset.success', 1);
|
ctx.statsd.incr('auth.reset.success', 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue