Skip to content

Commit

Permalink
Merge pull request #10 from JulienCoutault/feature/security
Browse files Browse the repository at this point in the history
WIP Security
  • Loading branch information
Clover-Lindo authored Aug 28, 2018
2 parents c2d5356 + c51c50f commit d21e081
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/app/core/service/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export class AuthService {
public loginWithMasterPassword(masterPassword: string): Promise<string | any> {
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();
Expand Down
6 changes: 5 additions & 1 deletion src/app/core/service/crypt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class CryptService {
}

public createHash(text: string) {
return crypto.createHash('sha512').update('lindo' + text).digest("hex");
}

public createHashMd5(text: string) {
return crypto.createHash('md5').update(text).digest("hex");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -305,4 +308,4 @@ export class MultiAccountComponent {
this.settingsService.option.vip.multiaccount.windows.push([])
}

}
}

0 comments on commit d21e081

Please sign in to comment.