diff --git a/frontend/src/app/components/auth/forgot-password/email-request/email-request.component.html b/frontend/src/app/components/auth/forgot-password/email-request/email-request.component.html index fc207e7..a4819e7 100644 --- a/frontend/src/app/components/auth/forgot-password/email-request/email-request.component.html +++ b/frontend/src/app/components/auth/forgot-password/email-request/email-request.component.html @@ -1,7 +1,3 @@ -
-

We will send you an email with instructions to reset your password.

-
-
Forgot your password?
- @if (!hasVerificationParams && !emailSendSuccess && !passwordChangeSuccess) - { + + + @if (!hasVerificationParams && !emailSentSuccessfully) { +
+

We will send you an email with instructions to reset your password.

+
+ - } @else { @if (emailSendSuccess) { + } + + + @if (hasVerificationParams && !passwordChangedSuccessfully) {
-

- If the email you entered exists on our server, you will receive a - message with instructions on how to reset your password. -

- To the login +

Please enter your new password and confirm it.

- } @if (passwordChangeSuccess) { -
-

- Password change successful.
You can now log in with your new - password. -

- To the login -
- } @if (hasVerificationParams && !passwordChangeSuccess) { + + } - } } + + @if (emailSentSuccessfully || passwordChangedSuccessfully) { +
+

+ {{ successMessage }} +

+ To the login +
+ }
diff --git a/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts b/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts index c956c77..78b3db9 100644 --- a/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts +++ b/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts @@ -21,8 +21,8 @@ import { firstValueFrom } from 'rxjs'; styleUrl: './forgot-password.component.scss', }) export class ForgotPasswordComponent implements OnInit { - emailSendSuccess: boolean = false; - passwordChangeSuccess: boolean = false; + emailSentSuccessfully: boolean = false; + passwordChangedSuccessfully: boolean = false; hasVerificationParams: boolean = false; verificationParams: { email: string; token: string } = { @@ -82,7 +82,7 @@ export class ForgotPasswordComponent implements OnInit { * @param success A boolean indicating whether the request was successful. */ submittedChangeEmail(success: boolean): void { - this.emailSendSuccess = success; + this.emailSentSuccessfully = success; } /** @@ -92,6 +92,15 @@ export class ForgotPasswordComponent implements OnInit { * @param success A boolean indicating whether the password change was successful. */ submittedChangePassword(success: boolean): void { - this.passwordChangeSuccess = success; + this.passwordChangedSuccessfully = success; + } + + get successMessage(): string { + if (this.emailSentSuccessfully) { + return 'If the email you entered exists on our server, you will receive a message with instructions on how to reset your password.'; + } else if (this.passwordChangedSuccessfully) { + return 'Password change successful. You can now log in with your new password.'; + } + return ''; } } diff --git a/frontend/src/app/components/auth/forgot-password/password-request/password-request.component.html b/frontend/src/app/components/auth/forgot-password/password-request/password-request.component.html index 4dc1c73..81b017b 100644 --- a/frontend/src/app/components/auth/forgot-password/password-request/password-request.component.html +++ b/frontend/src/app/components/auth/forgot-password/password-request/password-request.component.html @@ -1,7 +1,3 @@ -
-

Please enter your new password and confirm it.

-
-