UNPKG

@haechi-labs/henesis-cli

Version:

🚀 Command Line Interface tool to Utilize henesis

55 lines • 2.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const configstore_1 = tslib_1.__importDefault(require("../../common/configstore")); const user_1 = tslib_1.__importDefault(require("../../rpc/user")); const base_1 = tslib_1.__importDefault(require("../../common/base")); const utils_1 = require("../../utils"); class Changepw extends base_1.default { async run() { const user = configstore_1.default.get('user'); if (!user) { this.error('In order to use the Henesis CLI, you need to login first.\n' + 'Please use the henesis login command to get started.', { code: '460' }); } try { const password = await utils_1.passwordPrompt(); const newPassword1 = await utils_1.passwordPrompt('New Password'); if (newPassword1.length < 6) { this.error('Password you enter must be at least 6 characters long.', { code: '461', }); } const newPassword2 = await utils_1.passwordPrompt('Again New Password'); if (newPassword2.length < 6) { this.error('Password you enter must be at least 6 characters long.', { code: '461', }); } if (newPassword1 !== newPassword2) { this.error('The newly entered password does not match.', { code: '462', }); } await user_1.default.changePassword(password, newPassword1); this.log('🦄 Password changed!'); } catch (err) { this.error(err); } } } exports.default = Changepw; Changepw.description = 'change account password'; Changepw.examples = [ `$ henesis account:changepw Password: New Password: Again New Password: `, ]; //In order to use the Henesis CLI, you need to login first. //Please use the henesis login command to get started. Changepw.flags = {}; Changepw.args = []; //# sourceMappingURL=changepw.js.map