From 7b2f03b0d44939896f4586b29f070aef42077057 Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Sat, 19 Dec 2015 00:23:23 +0100 Subject: [PATCH] change api for password types --- app/app.js | 14 +++++++------- app/lesspass.js | 12 ++++++------ static/index.html | 7 ++++--- tests/lesspass.tests.js | 6 +++--- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/app.js b/app/app.js index d4eb6e5..08f4748 100644 --- a/app/app.js +++ b/app/app.js @@ -5,7 +5,7 @@ class lesspassController { constructor() { this.lowercase = true; this.uppercase = true; - this.number = true; + this.numbers = true; this.symbols = true; } displayHelp(){ @@ -14,21 +14,21 @@ class lesspassController { createPassword() { var passwordTypes = []; if (this.lowercase) { - passwordTypes.push('lowercase') + passwordTypes.push('lowercase'); } if (this.uppercase) { - passwordTypes.push('uppercase') + passwordTypes.push('uppercase'); } - if (this.number) { - passwordTypes.push('number') + if (this.numbers) { + passwordTypes.push('numbers'); } if (this.symbols) { - passwordTypes.push('symbols') + passwordTypes.push('symbols'); } var site_information = { 'site_name': this.site, 'password_length': 12, - 'password_type': passwordTypes, + 'password_types': passwordTypes, 'counter': 1 }; diff --git a/app/lesspass.js b/app/lesspass.js index 90ed40b..330070b 100644 --- a/app/lesspass.js +++ b/app/lesspass.js @@ -1,15 +1,15 @@ import crypto from 'crypto'; export class lesspass { - static create_password(master_password, site_information) { - var hash = this._create_hash(master_password, site_information); - var template = this._getTemplate(site_information.password_type); + static create_password(masterPassword, siteInformation) { + var hash = this._create_hash(masterPassword, siteInformation); + var template = this._getTemplate(siteInformation.password_types); return this._encode(hash, template); } - static _create_hash(master_password, {site_name, password_length=12, counter=1}) { + static _create_hash(masterPassword, {site_name, password_length=12, counter=1}) { var salt = site_name + counter.toString(); - var password = crypto.createHmac('sha256', master_password).update(salt).digest('hex'); + var password = crypto.createHmac('sha256', masterPassword).update(salt).digest('hex'); return password.substring(0, password_length); } @@ -26,7 +26,7 @@ export class lesspass { var passwordTypesInfo = { lowercase: {value: 'vc', order: 1}, uppercase: {value: 'VC', order: 2}, - number: {value: 'n', order: 3}, + numbers: {value: 'n', order: 3}, symbols: {value: 's', order: 4}, strong: {value: 'Cvcvns', order: 5} }; diff --git a/static/index.html b/static/index.html index 3653c67..aa4bcfa 100644 --- a/static/index.html +++ b/static/index.html @@ -24,7 +24,8 @@ } #headlines { - padding: 50px 0; + padding-top: 50px; + padding-bottom: 50px; } @@ -37,7 +38,7 @@