From ad035fa672b131d93e5161f9dd3277791dd03562 Mon Sep 17 00:00:00 2001 From: Programmateur01 Date: Mon, 27 Aug 2018 15:14:22 +0200 Subject: [PATCH 1/3] Change hash masterpassword (md5 to sha512) --- src/app/core/service/auth.service.ts | 7 +++++++ src/app/core/service/crypt.service.ts | 6 +++++- .../option/vip/multi-account/multi-account.component.ts | 7 +++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/app/core/service/auth.service.ts b/src/app/core/service/auth.service.ts index 02c7cde7..afd8e81b 100644 --- a/src/app/core/service/auth.service.ts +++ b/src/app/core/service/auth.service.ts @@ -25,6 +25,13 @@ export class AuthService { public loginWithMasterPassword(masterPassword: string): Promise { return new Promise((resolve, reject) => { if (this.settingsService.option.vip.multiaccount.master_password == this.cryptService.createHash(masterPassword)) { + // hash sha512 + resolve(masterPassword); + } else if (this.settingsService.option.vip.multiaccount.master_password == this.cryptService.createHashMd5(masterPassword)) { + // hash md5 + + // update hash password using sha512 + this.settingsService.option.vip.multiaccount.master_password = this.cryptService.createHash(masterPassword); resolve(masterPassword); } else { reject(); diff --git a/src/app/core/service/crypt.service.ts b/src/app/core/service/crypt.service.ts index 15cc47bf..4c742db1 100644 --- a/src/app/core/service/crypt.service.ts +++ b/src/app/core/service/crypt.service.ts @@ -24,6 +24,10 @@ export class CryptService { } public createHash(text: string) { + return crypto.createHash('sha512').update(text).digest("hex"); + } + + public createHashMd5(text: string) { return crypto.createHash('md5').update(text).digest("hex"); } -} \ No newline at end of file +} diff --git a/src/app/window/option/vip/multi-account/multi-account.component.ts b/src/app/window/option/vip/multi-account/multi-account.component.ts index f70246e9..b25ddefe 100644 --- a/src/app/window/option/vip/multi-account/multi-account.component.ts +++ b/src/app/window/option/vip/multi-account/multi-account.component.ts @@ -44,7 +44,10 @@ export class MultiAccountComponent { return new Promise(function (resolve, reject) { - if (masterPassword.length < 8) { reject(self.translate.instant("app.option.vip.multi-account.prompt.add-master.min-lenght", { "lenght": 8 })); return false; } + if (masterPassword.length < 8) { + reject(self.translate.instant("app.option.vip.multi-account.prompt.add-master.min-lenght", { "lenght": 8 })); + return false; + } self.applicationService.masterpassword = masterPassword; self.settingsService.option.vip.multiaccount.master_password = self.crypt.createHash(masterPassword); @@ -305,4 +308,4 @@ export class MultiAccountComponent { this.settingsService.option.vip.multiaccount.windows.push([]) } -} \ No newline at end of file +} From 3fc59d694224c48ec0c1946f58dc63fb7e8d1a82 Mon Sep 17 00:00:00 2001 From: Programmateur01 Date: Mon, 27 Aug 2018 15:28:33 +0200 Subject: [PATCH 2/3] Add salt --- src/app/core/service/crypt.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/service/crypt.service.ts b/src/app/core/service/crypt.service.ts index 4c742db1..729062a7 100644 --- a/src/app/core/service/crypt.service.ts +++ b/src/app/core/service/crypt.service.ts @@ -24,7 +24,7 @@ export class CryptService { } public createHash(text: string) { - return crypto.createHash('sha512').update(text).digest("hex"); + return crypto.createHash('sha512').update('lindo' + text).digest("hex"); } public createHashMd5(text: string) { From c51c50f39888b14d6a660b71f03b6cd5cb457275 Mon Sep 17 00:00:00 2001 From: Programmateur01 Date: Tue, 28 Aug 2018 09:38:48 +0200 Subject: [PATCH 3/3] Update package.json --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index afa66731..aa2c216d 100644 --- a/package.json +++ b/package.json @@ -55,14 +55,14 @@ "fs-extra": "5.0.0", "hammerjs": "2.0.8", "js-beautify": "1.7.5", - "macaddress": "0.2.8", + "macaddress": "0.2.9", "marked": "0.3.19", "ngx-chips": "1.8.2", "node-translate": "0.0.4", - "request": "2.83.0", + "request": "2.84.0", "request-progress": "3.0.0", "rxjs": "5.5.10", - "socket.io-client": "1.7.4", + "socket.io-client": "2.0.2", "sortablejs": "1.5.1", "sweetalert2": "6.6.10", "tslint": "5.9.1",