From c58d5c026bc2c8bae8098531bd18b46776bc84ba Mon Sep 17 00:00:00 2001 From: Chneemann Date: Sun, 6 Apr 2025 08:53:02 +0200 Subject: [PATCH] fix: minor bugfixes and UI adjustments --- .../login/forgot-pw/forgot-pw.component.ts | 18 ++++++++++-------- .../forgot-pw/pw-reset/pw-reset.component.ts | 2 ++ .../login/header/header.component.html | 7 ++++++- .../login/header/header.component.scss | 1 + .../login/header/header.component.ts | 4 ++-- src/app/components/login/login.component.html | 5 ++--- src/app/components/login/login.component.ts | 11 ++++------- .../login/register/register.component.ts | 7 +------ 8 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.ts b/src/app/components/login/forgot-pw/forgot-pw.component.ts index 28bc17e..83282db 100644 --- a/src/app/components/login/forgot-pw/forgot-pw.component.ts +++ b/src/app/components/login/forgot-pw/forgot-pw.component.ts @@ -35,9 +35,16 @@ export class ForgotPwComponent { ) {} onSubmit(ngForm: NgForm) { - this.buttonStateService.enableButton(); + this.buttonStateService.disableButton(); if (ngForm.submitted && ngForm.form.valid) { - this.authService.resetPassword(this.pwResetData.mail.toLowerCase()); + try { + this.authService.resetPassword(this.pwResetData.mail.toLowerCase()); + this.buttonStateService.enableButton(); + } catch (error: any) { + this.buttonStateService.enableButton(); + } + } else { + this.buttonStateService.enableButton(); } } @@ -46,11 +53,6 @@ export class ForgotPwComponent { } isEmailValid(emailValue: string) { - const emailRegex = /^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{2,}$/; - if (emailRegex.test(emailValue)) { - return true; - } else { - return false; - } + return /^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{2,}$/.test(emailValue); } } diff --git a/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.ts b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.ts index a4b20b4..2d0578e 100644 --- a/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.ts +++ b/src/app/components/login/forgot-pw/pw-reset/pw-reset.component.ts @@ -75,6 +75,8 @@ export class PwResetComponent { this.errorHttpMessage = error.message; this.buttonStateService.enableButton(); } + } else { + this.buttonStateService.enableButton(); } } } diff --git a/src/app/components/login/header/header.component.html b/src/app/components/login/header/header.component.html index d28552b..e3bb6b9 100644 --- a/src/app/components/login/header/header.component.html +++ b/src/app/components/login/header/header.component.html @@ -1,4 +1,9 @@ - + @if (signUpBtn) {

{{ "loginHeader.notAUser" | translate }}

diff --git a/src/app/components/login/header/header.component.scss b/src/app/components/login/header/header.component.scss index d35947d..3faa309 100644 --- a/src/app/components/login/header/header.component.scss +++ b/src/app/components/login/header/header.component.scss @@ -4,6 +4,7 @@ top: 60px; height: 100px; width: 122px; + cursor: pointer; } .register { diff --git a/src/app/components/login/header/header.component.ts b/src/app/components/login/header/header.component.ts index c59d766..48218e6 100644 --- a/src/app/components/login/header/header.component.ts +++ b/src/app/components/login/header/header.component.ts @@ -1,12 +1,12 @@ import { Component, Input } from '@angular/core'; -import { RouterModule } from '@angular/router'; +import { RouterLink, RouterModule } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { LanguageService } from '../../../services/language.service'; @Component({ selector: 'app-header', standalone: true, - imports: [RouterModule, TranslateModule], + imports: [RouterModule, RouterLink, TranslateModule], templateUrl: './header.component.html', styleUrl: './header.component.scss', }) diff --git a/src/app/components/login/login.component.html b/src/app/components/login/login.component.html index d8d396c..279d2ef 100644 --- a/src/app/components/login/login.component.html +++ b/src/app/components/login/login.component.html @@ -39,8 +39,7 @@ !isButtonDisabled()) {

{{ "login.errorMail1" | translate }}

} @if (mail.valid && mail.touched && - !checkIfUserEmailIsValid(loginData.email.toLowerCase()) && - !isButtonDisabled()) { + !isEmailValid(loginData.email.toLowerCase()) && !isButtonDisabled()) {

{{ "login.errorMail2" | translate }}

}
@@ -109,7 +108,7 @@ password.invalid || !loginData.password || isButtonDisabled() || - !checkIfUserEmailIsValid(loginData.email) + !isEmailValid(loginData.email) " >