added pw reset & update design

This commit is contained in:
Chneemann 2024-05-20 17:35:00 +02:00
parent e93177ebb3
commit 7464e8e265
4 changed files with 33 additions and 4 deletions

View file

@ -70,4 +70,3 @@
</form>
<app-footer></app-footer>
</section>
<app-loading-dialog></app-loading-dialog>

View file

@ -45,7 +45,7 @@ section {
flex-direction: column;
align-items: center;
position: relative;
width: 90%;
width: 60%;
.custom-input::-webkit-contacts-auto-fill-button {
visibility: hidden;
}
@ -146,6 +146,10 @@ section {
}
}
.input-fields {
width: 75%;
}
.notice {
p {
font-size: 18px;
@ -171,6 +175,10 @@ section {
}
}
.input-fields {
width: 90%;
}
.loading-text {
margin-top: 180px;
p {

View file

@ -43,7 +43,7 @@ export class ForgotPwComponent {
onSubmit(ngForm: NgForm) {
this.sharedService.isBtnDisabled = true;
if (ngForm.submitted && ngForm.form.valid) {
// this.loginSerivce.login(this.pwResetData);
this.loginSerivce.passwordReset(this.pwResetData.mail);
}
}

View file

@ -5,6 +5,7 @@ import {
signInWithPopup,
GoogleAuthProvider,
createUserWithEmailAndPassword,
sendPasswordResetEmail,
} from 'firebase/auth';
import { FirebaseService } from './firebase.service';
import {
@ -19,6 +20,8 @@ import {
} from '@angular/fire/firestore';
import { SharedService } from './shared.service';
import { User } from '../interfaces/user.interface';
import { NgForm } from '@angular/forms';
import { Router } from '@angular/router';
@Injectable({
providedIn: 'root',
})
@ -30,7 +33,8 @@ export class LoginService {
constructor(
private firebaseService: FirebaseService,
public sharedService: SharedService
public sharedService: SharedService,
private router: Router
) {}
login(loginData: { mail: string; password: string }) {
@ -200,4 +204,22 @@ export class LoginService {
deleteUserIdInLocalStorage() {
localStorage.removeItem('currentUserJOIN');
}
// FORGOT PASSWORD
passwordReset(email: string) {
console.log(email);
const auth = getAuth();
sendPasswordResetEmail(auth, email)
.then(() => {
this.router.navigate(['/login']);
this.sharedService.isBtnDisabled = false;
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
this.sharedService.isBtnDisabled = false;
});
}
}