diff --git a/apps/web/src/app/accounts/login/login.component.html b/apps/web/src/app/accounts/login/login.component.html index f12595ae41..00f5432459 100644 --- a/apps/web/src/app/accounts/login/login.component.html +++ b/apps/web/src/app/accounts/login/login.component.html @@ -55,7 +55,8 @@

{{ "newAroundHere" | i18n }} - {{ "createAccount" | i18n }} + + {{ "createAccount" | i18n }}

diff --git a/apps/web/src/app/accounts/login/login.component.ts b/apps/web/src/app/accounts/login/login.component.ts index dab88d203d..a431d47ac9 100644 --- a/apps/web/src/app/accounts/login/login.component.ts +++ b/apps/web/src/app/accounts/login/login.component.ts @@ -189,6 +189,17 @@ export class LoginComponent extends BaseLoginComponent implements OnInit, OnDest this.router.navigateByUrl("/hint"); } + goToRegister() { + const email = this.formGroup.value.email; + + if (email) { + this.router.navigate(["/register"], { queryParams: { email: email } }); + return; + } + + this.router.navigate(["/register"]); + } + async submit() { const rememberEmail = this.formGroup.value.rememberEmail; diff --git a/libs/components/src/input/input.directive.ts b/libs/components/src/input/input.directive.ts index c72c6e8960..ed7faeac82 100644 --- a/libs/components/src/input/input.directive.ts +++ b/libs/components/src/input/input.directive.ts @@ -1,4 +1,13 @@ -import { Directive, ElementRef, HostBinding, Input, NgZone, Optional, Self } from "@angular/core"; +import { + Directive, + ElementRef, + HostBinding, + HostListener, + Input, + NgZone, + Optional, + Self, +} from "@angular/core"; import { NgControl, Validators } from "@angular/forms"; import { BitFormFieldControl, InputTypes } from "../form-field/form-field-control"; @@ -67,8 +76,19 @@ export class BitInputDirective implements BitFormFieldControl { return this.id; } + private isActive = true; + @HostListener("blur") + onBlur() { + this.isActive = true; + } + + @HostListener("input") + onInput() { + this.isActive = false; + } + get hasError() { - return this.ngControl?.status === "INVALID" && this.ngControl?.touched; + return this.ngControl?.status === "INVALID" && this.ngControl?.touched && this.isActive; } get error(): [string, any] {