Browse Source

Change password

power-cycle
Mayank 4 years ago
parent
commit
4b06a685f4
No known key found for this signature in database GPG Key ID: D037D60476CE748C
  1. 22
      .github/ISSUE_TEMPLATE/feature_request.md
  2. 7
      logic/auth.js
  3. 1
      package.json
  4. 7
      routes/v1/account.js
  5. 11
      utils/const.js
  6. 41
      yarn.lock

22
.github/ISSUE_TEMPLATE/feature_request.md

@ -1,22 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Issue**
A clear and concise description of what the problem is.
**Proposed Solution**
A clear and concise description of what you want to happen.
**Dependencies**
1. Links to PRs
2. Links to Issues
3. Description of other dependencies
**Additional context**
Add any other context or screenshots about the feature request here.

7
logic/auth.js

@ -1,7 +1,8 @@
const path = require('path');
const bcrypt = require('bcrypt');
const iocane = require("iocane");
const compose = require("docker-compose");
const diskLogic = require('logic/disk.js');
// const dockerComposeLogic = require('logic/docker-compose.js');
const lndApiService = require('services/lndApi.js');
const bashService = require('services/bash.js');
const NodeError = require('models/errors.js').NodeError;
@ -43,9 +44,9 @@ async function changePassword(currentPassword, newPassword, jwt) {
// restart lnd
resetChangePasswordStatus();
changePasswordStatus.percent = 1; // eslint-disable-line no-magic-numbers
// await dockerComposeLogic.dockerComposeStop({ service: constants.SERVICES.LND });
await compose.stopOne('lnd', { cwd: constants.DOCKER_COMPOSE_DIRECTORY });
changePasswordStatus.percent = 40; // eslint-disable-line no-magic-numbers
// await dockerComposeLogic.dockerComposeUpSingleService({ service: constants.SERVICES.LND });
await compose.upOne('lnd', { cwd: constants.DOCKER_COMPOSE_DIRECTORY });
let complete = false;
let attempt = 0;

1
package.json

@ -19,6 +19,7 @@
"continuation-local-storage": "^3.2.1",
"cors": "^2.8.5",
"debug": "^4.1.1",
"docker-compose": "^0.23.4",
"dotenv": "^8.2.0",
"express": "^4.16.3",
"fs-extra": "^9.0.0",

7
routes/v1/account.js

@ -13,11 +13,8 @@ const validator = require('utils/validator.js');
const COMPLETE = 100;
// Endpoint to change your lnd password. Wallet must exist and be unlocked. This endpoint is authorized with basic auth
// or the property password from the body.
router.post('/change-password', auth.convertReqBodyToBasicAuth, auth.basic, incorrectPasswordAuthHandler,
safeHandler(async (req, res, next) => {
// Endpoint to change your lnd password. Wallet must exist and be unlocked.
router.post('/change-password', auth.convertReqBodyToBasicAuth, auth.basic, incorrectPasswordAuthHandler, safeHandler(async (req, res, next) => {
// Use password from the body by default. Basic auth has issues handling special characters.
const currentPassword = req.body.password;
const newPassword = req.body.newPassword;

11
utils/const.js

@ -1,10 +1,11 @@
/* eslint-disable id-length */
module.exports = {
REQUEST_CORRELATION_NAMESPACE_KEY: 'umbrel-manager-request',
REQUEST_CORRELATION_ID_KEY: 'reqId',
USER_FILE: process.env.USER_FILE || '/db/user.json',
JWT_PUBLIC_KEY_FILE: process.env.JWT_PUBLIC_KEY_FILE || '/db/jwt-public-key/jwt.pem',
JWT_PRIVATE_KEY_FILE: process.env.JWT_PRIVATE_KEY_FILE || '/db/jwt-private-key/jwt.key',
REQUEST_CORRELATION_ID_KEY: 'reqId',
DOCKER_COMPOSE_DIRECTORY: process.env.DOCKER_COMPOSE_DIRECTORY || '/docker-compose',
STATUS_CODES: {
ACCEPTED: 202,
BAD_GATEWAY: 502,
@ -13,4 +14,12 @@ module.exports = {
OK: 200,
UNAUTHORIZED: 401
},
TIME: {
FIVE_MINUTES_IN_MILLIS: 5 * 60 * 1000,
ONE_DAY_IN_MILLIS: 24 * 60 * 60 * 10001000,
ONE_SECOND_IN_MILLIS: 1000,
ONE_HOUR_IN_MILLIS: 60 * 60 * 1000,
NINETY_MINUTES_IN_MILLIS: 90 * 60 * 1000,
HOURS_IN_TWO_DAYS: 47,
}
};

41
yarn.lock

@ -1346,7 +1346,7 @@ debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
dependencies:
ms "^2.1.1"
debuglog@*, debuglog@^1.0.1:
debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@ -1478,6 +1478,11 @@ diff@^4.0.2:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
docker-compose@^0.23.4:
version "0.23.4"
resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.23.4.tgz#43bcabcde55a6ba2873b52fe0ccd99dd8fdceba8"
integrity sha512-yWdXby9uQ8o4syOfvoSJ9ZlTnLipvUmDn59uaYY5VGIUSUAfMPPGqE1DE3pOCnfSg9Tl9UOOFO0PCSAzuIHmuA==
doctrine@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"
@ -2542,7 +2547,7 @@ import-lazy@^2.1.0:
resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"
integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=
imurmurhash@*, imurmurhash@^0.1.4:
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@ -3282,11 +3287,6 @@ lockfile@^1.0.4:
dependencies:
signal-exit "^3.0.2"
lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
lodash._baseuniq@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@ -3295,33 +3295,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0"
lodash._root "~3.0.0"
lodash._bindcallback@*:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
dependencies:
lodash._getnative "^3.0.0"
lodash._createset@~4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
lodash._getnative@*, lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
lodash._root@~3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692"
@ -3377,11 +3355,6 @@ lodash.once@^4.0.0:
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
integrity sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=
lodash.restparam@*:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
lodash.union@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"

Loading…
Cancel
Save