update tslint -> eslint

This commit is contained in:
2021-05-21 20:17:26 +02:00
parent 80260df71f
commit a195fafa6b
252 changed files with 3080 additions and 2420 deletions

View File

@@ -2,14 +2,18 @@
<div [formGroup]="form" class="form">
<mat-form-field appearance="outline">
<mat-label>E-Mail Addresse</mat-label>
<input (keyup.enter)="onResetPassword()" formControlName="user" matInput>
<input
(keyup.enter)="onResetPassword()"
formControlName="user"
matInput
/>
</mat-form-field>
<app-button-row>
<app-button (click)="onResetPassword()" [icon]="faNewPassword">neues Passwort anfordern</app-button>
<p *ngIf="errorMessage" class="error">{{errorMessage|authMessage}}</p>
<app-button (click)="onResetPassword()" [icon]="faNewPassword"
>neues Passwort anfordern
</app-button>
<p *ngIf="errorMessage" class="error">{{ errorMessage | authMessage }}</p>
</app-button-row>
</div>
</app-card>

View File

@@ -6,12 +6,13 @@ describe('PasswordComponent', () => {
let component: PasswordComponent;
let fixture: ComponentFixture<PasswordComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [PasswordComponent]
beforeEach(
waitForAsync(() => {
void TestBed.configureTestingModule({
declarations: [PasswordComponent],
}).compileComponents();
})
.compileComponents();
}));
);
beforeEach(() => {
fixture = TestBed.createComponent(PasswordComponent);
@@ -20,6 +21,6 @@ describe('PasswordComponent', () => {
});
it('should create', () => {
expect(component).toBeTruthy();
void expect(component).toBeTruthy();
});
});

View File

@@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {FormControl, FormGroup, Validators} from '@angular/forms';
import {AbstractControl, FormControl, FormGroup, Validators} from '@angular/forms';
import {Router} from '@angular/router';
import {UserService} from '../../../services/user/user.service';
import {faWindowRestore} from '@fortawesome/free-solid-svg-icons/faWindowRestore';
@@ -7,32 +7,33 @@ import {faWindowRestore} from '@fortawesome/free-solid-svg-icons/faWindowRestore
@Component({
selector: 'app-password',
templateUrl: './password.component.html',
styleUrls: ['./password.component.less']
styleUrls: ['./password.component.less'],
})
export class PasswordComponent implements OnInit {
public form: FormGroup;
public errorMessage: string;
public faNewPassword = faWindowRestore;
constructor(public userService: UserService, private router: Router) {
}
public constructor(public userService: UserService, private router: Router) {}
public ngOnInit(): void {
const required = (c: AbstractControl) => Validators.required(c);
const email = Validators.email;
this.form = new FormGroup({
user: new FormControl(null, [Validators.required, Validators.email])
user: new FormControl(null, [required, email]),
});
}
public async onResetPassword() {
public async onResetPassword(): Promise<void> {
this.form.updateValueAndValidity();
if (this.form.valid) {
try {
await this.userService.changePassword(this.form.value.user);
const value = this.form.value as {user: string};
await this.userService.changePassword(value.user);
await this.router.navigateByUrl('/user/password-send');
} catch (ex) {
this.errorMessage = ex.code;
} catch ({code}) {
this.errorMessage = code as string;
}
}
}
}