From 0a4a59e6d61b06e9473683471f0ef0267ac2b861 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 28 Oct 2019 20:59:02 +0100 Subject: [PATCH] fixed login button changed hash to sha512 --- package-lock.json | 5 +++++ package.json | 1 + src/app/components/login/login.component.html | 2 +- src/app/components/login/login.component.ts | 7 +++---- src/app/components/register/register.component.ts | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 86c7311..2fa68fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5808,6 +5808,11 @@ "integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==", "optional": true }, + "js-sha512": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", + "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", diff --git a/package.json b/package.json index a943834..6d67d2e 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "core-js": "^2.5.4", "graphql": "^14.3.1", "graphql-tag": "^2.10.0", + "js-sha512": "^0.8.0", "ngx-socket-io": "^2.0.0", "rxjs": "~6.3.3", "ts-md5": "^1.2.6", diff --git a/src/app/components/login/login.component.html b/src/app/components/login/login.component.html index 837e839..2a73b45 100644 --- a/src/app/components/login/login.component.html +++ b/src/app/components/login/login.component.html @@ -11,7 +11,7 @@
- +

{{errorMessage}}



diff --git a/src/app/components/login/login.component.ts b/src/app/components/login/login.component.ts index 75fbb95..c83a92d 100644 --- a/src/app/components/login/login.component.ts +++ b/src/app/components/login/login.component.ts @@ -1,9 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { Login } from 'src/app/models/login'; import { LoginService } from 'src/app/services/login/login.service'; -import { RouterLink } from '@angular/router'; import {Router} from '@angular/router'; -import {Md5} from 'ts-md5/dist/md5'; +import * as sha512 from 'js-sha512'; @Component({ selector: 'app-login', @@ -30,8 +29,8 @@ export class LoginComponent implements OnInit { this.errorOccurred = false; this.errorMessage = " "; this.login.email = pEmail - const md5 = new Md5(); - this.login.passwordHash = md5.appendStr(pPasswordHash).end() as string + this.login.passwordHash = sha512.sha512(pPasswordHash); + console.log(this.login.passwordHash); this.loginService.login(this.login, error => this.loginError(error.json())); } diff --git a/src/app/components/register/register.component.ts b/src/app/components/register/register.component.ts index b659e5a..90c6945 100644 --- a/src/app/components/register/register.component.ts +++ b/src/app/components/register/register.component.ts @@ -4,6 +4,7 @@ import {Registration} from '../../models/registration'; import {Router} from '@angular/router'; import {Md5} from 'ts-md5/dist/md5'; import { parseWebDriverCommand } from 'blocking-proxy/built/lib/webdriver_commands'; +import * as sha512 from 'js-sha512'; @Component({ selector: 'registration', @@ -31,8 +32,7 @@ export class RegisterComponent implements OnInit { if(this.passwordSame(pPasswordHash,pPasswordHashRepeat)){ this.registration.username = pUsername this.registration.email = pEmail - const md5 = new Md5(); - this.registration.passwordHash = md5.appendStr(pPasswordHash).end() as string + this.registration.passwordHash = sha512.sha512(pPasswordHash); this.registerService.register(this.registration, error => this.registerError(error.json())); } }