diff --git a/UI/Web/src/app/registration/user-login/user-login.component.html b/UI/Web/src/app/registration/user-login/user-login.component.html index 0c2671334..950b1c995 100644 --- a/UI/Web/src/app/registration/user-login/user-login.component.html +++ b/UI/Web/src/app/registration/user-login/user-login.component.html @@ -9,18 +9,55 @@
- + + @if (loginForm.get('username')?.invalid && loginForm.get('username')?.touched) { +
+ {{t('username-required')}} +
+ }
- + + @if (loginForm.get('password')?.invalid && loginForm.get('password')?.touched) { +
+ @if (loginForm.get('password')?.errors?.['required']) { + {{t('password-required')}} + } + @if (loginForm.get('password')?.errors?.['minlength']) { + {{t('password-min-length')}} + } + @if (loginForm.get('password')?.errors?.['maxlength']) { + {{t('password-max-length')}} + } +
+ }
- +
@@ -31,15 +68,16 @@ } @if (showOidcButton()) { +
- + {{oidcConfig()?.providerName || t('oidc')}} } } - + \ No newline at end of file diff --git a/UI/Web/src/app/registration/user-login/user-login.component.scss b/UI/Web/src/app/registration/user-login/user-login.component.scss index 274fce84b..3289a97b3 100644 --- a/UI/Web/src/app/registration/user-login/user-login.component.scss +++ b/UI/Web/src/app/registration/user-login/user-login.component.scss @@ -8,6 +8,12 @@ div { a { font-size: 0.8rem; + font-family: var(--login-input-font-family); + + &.btn { + font-size: 1rem; + padding: 0.375rem 0.75rem; + } } .custom-input { @@ -31,8 +37,9 @@ a { .invalid-feedback { display: inline-block; - color: var(--bs-form-invalid-color); + background: var(--bs-form-invalid-color); font-family: var(--login-input-font-family); + color: var(--login-input-color); } .forgot-password { @@ -52,3 +59,12 @@ a { .text-muted { font-size: 0.8rem; } + + +hr { + border-top: 1px solid; + max-width: 80%; + text-align: center; + margin-left: auto; + margin-right: auto; +} \ No newline at end of file diff --git a/UI/Web/src/app/registration/user-login/user-login.component.ts b/UI/Web/src/app/registration/user-login/user-login.component.ts index c0e3190e4..b238c846f 100644 --- a/UI/Web/src/app/registration/user-login/user-login.component.ts +++ b/UI/Web/src/app/registration/user-login/user-login.component.ts @@ -43,7 +43,7 @@ export class UserLoginComponent implements OnInit { loginForm: FormGroup = new FormGroup({ username: new FormControl('', [Validators.required]), - password: new FormControl('', [Validators.required, Validators.maxLength(256), Validators.minLength(6), Validators.pattern("^.{6,256}$")]) + password: new FormControl('', [Validators.required, Validators.maxLength(256), Validators.minLength(6)]) }); /** @@ -95,6 +95,9 @@ export class UserLoginComponent implements OnInit { } ngOnInit(): void { + // Ensure isSubmitting is false on component initialization + this.isSubmitting.set(false); + this.accountService.currentUser$.pipe(take(1)).subscribe(user => { if (user) { this.navService.handleLogin() @@ -113,6 +116,7 @@ export class UserLoginComponent implements OnInit { } this.isLoaded.set(true); + this.cdRef.markForCheck(); }); this.route.queryParamMap.subscribe(params => { @@ -138,20 +142,28 @@ export class UserLoginComponent implements OnInit { login(apiKey: string = '') { + // Don't proceed if form is invalid (for regular form submission) + if (!apiKey && this.loginForm.invalid) { + this.loginForm.markAllAsTouched(); + return; + } + const model = this.loginForm.getRawValue(); model.apiKey = apiKey; this.isSubmitting.set(true); + this.accountService.login(model).subscribe({ next: () => { this.loginForm.reset(); this.navService.handleLogin() - this.isSubmitting.set(false); + this.cdRef.markForCheck(); }, error: (err) => { this.toastr.error(err.error); this.isSubmitting.set(false); + this.cdRef.markForCheck(); } }); } -} +} \ No newline at end of file