I'm new to Angular and I'm creating a forgot password link, which when the user interacts with it will send out an email to their email address with a unique password token in order so they can reset their password. I want to be able to recognize the user, using their user identifier and match their email address with this and send out the email.
- Do I need to pass in the user identifier or user email address into the service?
- How do I structure the ngOnInit?
// user.service.ts
public forgotUserPasswordVerification(email: string): Observable<void> { // email or identifier??
return this.http.post<void>('api/verifications/forgotpasswordverification', email);
}
// forgot-password.component.ts
ngOnInit() {
this.userService.forgotUserPasswordVerification(this.email) // this.email or this.identifier?
.subscribe(data => {
this.success = true;
})};