Chore: Upgrade to Angular v18
Chore: Upgrade to Python 3.12 Chore: Upgrade to psycopg3
This commit is contained in:
@ -1,5 +1,11 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { FormControl, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { MatCard, MatCardHeader, MatCardTitle, MatCardContent, MatCardActions } from '@angular/material/card';
|
||||
import { MatDivider } from '@angular/material/divider';
|
||||
import { MatFormField, MatLabel, MatSuffix } from '@angular/material/form-field';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
@ -10,6 +16,22 @@ import { AuthService } from '../auth.service';
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.component.html',
|
||||
styleUrls: ['./login.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitle,
|
||||
MatCardContent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
MatIcon,
|
||||
MatSuffix,
|
||||
MatDivider,
|
||||
MatCardActions,
|
||||
MatButton,
|
||||
],
|
||||
})
|
||||
export class LoginComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
@ -61,17 +83,17 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
this.auth
|
||||
.login(username.trim(), password.trim())
|
||||
// .pipe(first())
|
||||
.subscribe(
|
||||
() => {
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.router.navigateByUrl(this.returnUrl);
|
||||
},
|
||||
(error) => {
|
||||
if (error.status === 401 && error.error.detail === 'Device is not registered') {
|
||||
error: (error) => {
|
||||
if (error.status === 401 && error.detail === 'Device is not registered') {
|
||||
this.unregisteredDevice = true;
|
||||
this.deviceName = this.cs.getCookie('device');
|
||||
}
|
||||
this.toaster.show('Error', error.error.detail);
|
||||
this.toaster.show('Error', error.detail);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user