added pw reset & update design
This commit is contained in:
parent
e93177ebb3
commit
7464e8e265
4 changed files with 33 additions and 4 deletions
|
|
@ -70,4 +70,3 @@
|
||||||
</form>
|
</form>
|
||||||
<app-footer></app-footer>
|
<app-footer></app-footer>
|
||||||
</section>
|
</section>
|
||||||
<app-loading-dialog></app-loading-dialog>
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ section {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 90%;
|
width: 60%;
|
||||||
.custom-input::-webkit-contacts-auto-fill-button {
|
.custom-input::-webkit-contacts-auto-fill-button {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
@ -146,6 +146,10 @@ section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input-fields {
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
.notice {
|
.notice {
|
||||||
p {
|
p {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
|
|
@ -171,6 +175,10 @@ section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input-fields {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
.loading-text {
|
.loading-text {
|
||||||
margin-top: 180px;
|
margin-top: 180px;
|
||||||
p {
|
p {
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export class ForgotPwComponent {
|
||||||
onSubmit(ngForm: NgForm) {
|
onSubmit(ngForm: NgForm) {
|
||||||
this.sharedService.isBtnDisabled = true;
|
this.sharedService.isBtnDisabled = true;
|
||||||
if (ngForm.submitted && ngForm.form.valid) {
|
if (ngForm.submitted && ngForm.form.valid) {
|
||||||
// this.loginSerivce.login(this.pwResetData);
|
this.loginSerivce.passwordReset(this.pwResetData.mail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import {
|
||||||
signInWithPopup,
|
signInWithPopup,
|
||||||
GoogleAuthProvider,
|
GoogleAuthProvider,
|
||||||
createUserWithEmailAndPassword,
|
createUserWithEmailAndPassword,
|
||||||
|
sendPasswordResetEmail,
|
||||||
} from 'firebase/auth';
|
} from 'firebase/auth';
|
||||||
import { FirebaseService } from './firebase.service';
|
import { FirebaseService } from './firebase.service';
|
||||||
import {
|
import {
|
||||||
|
|
@ -19,6 +20,8 @@ import {
|
||||||
} from '@angular/fire/firestore';
|
} from '@angular/fire/firestore';
|
||||||
import { SharedService } from './shared.service';
|
import { SharedService } from './shared.service';
|
||||||
import { User } from '../interfaces/user.interface';
|
import { User } from '../interfaces/user.interface';
|
||||||
|
import { NgForm } from '@angular/forms';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
|
|
@ -30,7 +33,8 @@ export class LoginService {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private firebaseService: FirebaseService,
|
private firebaseService: FirebaseService,
|
||||||
public sharedService: SharedService
|
public sharedService: SharedService,
|
||||||
|
private router: Router
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
login(loginData: { mail: string; password: string }) {
|
login(loginData: { mail: string; password: string }) {
|
||||||
|
|
@ -200,4 +204,22 @@ export class LoginService {
|
||||||
deleteUserIdInLocalStorage() {
|
deleteUserIdInLocalStorage() {
|
||||||
localStorage.removeItem('currentUserJOIN');
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue