reset password

This commit is contained in:
2020-04-24 15:37:27 +02:00
committed by smuddy
parent 0e8a493deb
commit 732353f5bd
14 changed files with 161 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
import {Component, OnInit} from '@angular/core';
import {FormControl, FormGroup, Validators} from '@angular/forms';
import {AngularFireAuth} from '@angular/fire/auth';
import {Router} from '@angular/router';
import {UserService} from '../../../services/user.service';
@Component({
selector: 'app-login',
@@ -12,7 +12,7 @@ export class LoginComponent implements OnInit {
public form: FormGroup;
public errorMessage: string;
constructor(public afAuth: AngularFireAuth, private router: Router) {
constructor(private userService: UserService, private router: Router) {
}
ngOnInit() {
@@ -26,7 +26,7 @@ export class LoginComponent implements OnInit {
this.form.updateValueAndValidity();
if (this.form.valid) {
try {
await this.afAuth.auth.signInWithEmailAndPassword(this.form.value.user, this.form.value.pass);
await this.userService.login(this.form.value.user, this.form.value.pass);
await this.router.navigateByUrl('/');
} catch (ex) {
this.errorMessage = ex.code;