-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added forgot password + firebase email
- Loading branch information
1 parent
d028e18
commit b627278
Showing
10 changed files
with
146 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; | ||
import { ApplicationConfig, provideZoneChangeDetection, importProvidersFrom } from '@angular/core'; | ||
import { provideRouter } from '@angular/router'; | ||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
import { routes } from './app.routes'; | ||
|
||
export const appConfig: ApplicationConfig = { | ||
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)] | ||
providers: [ | ||
provideZoneChangeDetection({ eventCoalescing: true }), | ||
provideRouter(routes), | ||
importProvidersFrom(BrowserAnimationsModule) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 35 additions & 2 deletions
37
src/app/login/password/reset-password/reset-password.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,48 @@ | ||
import { Component } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { LoginLogoComponent } from '../../shared/login-logo/login-logo.component'; | ||
import { LoginFooterComponent } from '../../shared/login-footer/login-footer.component'; | ||
import { getAuth, sendPasswordResetEmail } from 'firebase/auth'; | ||
import { CommonModule } from '@angular/common'; | ||
import { MatSnackBar } from '@angular/material/snack-bar'; | ||
|
||
|
||
|
||
@Component({ | ||
selector: 'app-reset-password', | ||
standalone: true, | ||
imports: [LoginLogoComponent, LoginFooterComponent], | ||
imports: [LoginLogoComponent, LoginFooterComponent, FormsModule, CommonModule], | ||
templateUrl: './reset-password.component.html', | ||
styleUrl: './reset-password.component.scss' | ||
styleUrls: ['./reset-password.component.scss'] | ||
}) | ||
export class ResetPasswordComponent { | ||
|
||
constructor(private snackBar: MatSnackBar) {} | ||
email: string = ''; | ||
|
||
resetPassword() { | ||
const auth = getAuth(); | ||
sendPasswordResetEmail(auth, this.email) | ||
.then(() => { | ||
this.snackBar.open('Ein Link zum Zurücksetzen des Passworts wurde an Ihre E-Mail-Adresse gesendet.', 'Schließen', { | ||
duration: 5000, | ||
}); | ||
}) | ||
.catch((error) => { | ||
if (error.code === 'auth/user-not-found') { | ||
this.snackBar.open('Es gab einen Fehler beim Senden der E-Mail zum Zurücksetzen des Passworts. Bitte überprüfen Sie Ihre E-Mail-Adresse.', 'Schließen', { | ||
duration: 5000, | ||
}); | ||
} else if (error.code === 'auth/invalid-email') { | ||
this.snackBar.open('Diese E-Mail-Adresse ist ungültig.', 'Schließen', { | ||
duration: 5000, | ||
}); | ||
} else { | ||
this.snackBar.open('Es ist ein unbekannter Fehler aufgetreten. Bitte versuchen Sie es später erneut.', 'Schließen', { | ||
duration: 5000, | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters