From 2bf173da078fdaa7079e08838ff56d9933e66115 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 9 Mar 2020 16:25:28 +0100 Subject: [PATCH] Fix check if password is empty on register page --- src/app/components/register/register.component.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/components/register/register.component.ts b/src/app/components/register/register.component.ts index ca5f1b9..7522922 100644 --- a/src/app/components/register/register.component.ts +++ b/src/app/components/register/register.component.ts @@ -1,6 +1,6 @@ -import {Component, OnInit} from '@angular/core'; -import {RegisterService} from '../../services/register/register.service'; -import {Registration} from '../../models/registration'; +import { Component, OnInit } from '@angular/core'; +import { RegisterService } from '../../services/register/register.service'; +import { Registration } from '../../models/registration'; import * as sha512 from 'js-sha512'; @Component({ @@ -18,7 +18,7 @@ export class RegisterComponent implements OnInit { imprintCheck = false; constructor(private registerService: RegisterService) { - this.registration = {username: null, passwordHash: null, email: null}; + this.registration = { username: null, passwordHash: null, email: null }; } public registerError(error: any) { @@ -39,6 +39,11 @@ export class RegisterComponent implements OnInit { } passwordSame(pwd: string, pwd2: string) { + if (!pwd) { + this.errorOccurred = true; + this.errorMessage = 'please enter a password'; + return false; + } if (pwd === pwd2) { return true; } else {