diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.html b/src/app/components/login/forgot-pw/forgot-pw.component.html
index 1369d4f..ca22e2d 100644
--- a/src/app/components/login/forgot-pw/forgot-pw.component.html
+++ b/src/app/components/login/forgot-pw/forgot-pw.component.html
@@ -70,4 +70,3 @@
-
diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.scss b/src/app/components/login/forgot-pw/forgot-pw.component.scss
index e0e7714..257e08b 100644
--- a/src/app/components/login/forgot-pw/forgot-pw.component.scss
+++ b/src/app/components/login/forgot-pw/forgot-pw.component.scss
@@ -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 {
diff --git a/src/app/components/login/forgot-pw/forgot-pw.component.ts b/src/app/components/login/forgot-pw/forgot-pw.component.ts
index d94aa2f..d7d7b0d 100644
--- a/src/app/components/login/forgot-pw/forgot-pw.component.ts
+++ b/src/app/components/login/forgot-pw/forgot-pw.component.ts
@@ -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);
}
}
diff --git a/src/app/services/login.service.ts b/src/app/services/login.service.ts
index f345471..1bbb462 100644
--- a/src/app/services/login.service.ts
+++ b/src/app/services/login.service.ts
@@ -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;
+ });
+ }
}