-
+
diff --git a/src/Ombi/ClientApp/app/login/resetpassword.component.ts b/src/Ombi/ClientApp/app/login/resetpassword.component.ts
index be7b16b18..b033ee4ca 100644
--- a/src/Ombi/ClientApp/app/login/resetpassword.component.ts
+++ b/src/Ombi/ClientApp/app/login/resetpassword.component.ts
@@ -1,7 +1,7 @@
import { Component, OnInit } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
-import { ICustomizationSettings } from "../interfaces";
+import { ICustomizationSettings, IEmailNotificationSettings } from "../interfaces";
import { IdentityService } from "../services";
import { NotificationService } from "../services";
import { SettingsService } from "../services";
@@ -14,6 +14,7 @@ export class ResetPasswordComponent implements OnInit {
public form: FormGroup;
public customizationSettings: ICustomizationSettings;
+ public emailSettings: IEmailNotificationSettings;
constructor(private identityService: IdentityService, private notify: NotificationService,
private fb: FormBuilder, private settingsService: SettingsService) {
@@ -24,17 +25,24 @@ export class ResetPasswordComponent implements OnInit {
public ngOnInit() {
this.settingsService.getCustomization().subscribe(x => this.customizationSettings = x);
+ this.settingsService.getEmailNotificationSettings().subscribe(x => this.emailSettings = x);
}
public onSubmit(form: FormGroup) {
- if (form.invalid) {
- this.notify.error("Validation", "Email address is required");
+ if (this.emailSettings && this.emailSettings.enabled) {
+
+ if (form.invalid) {
+ this.notify.error("Validation", "Email address is required");
+ return;
+ }
+ this.identityService.submitResetPassword(form.value.email).subscribe(x => {
+ x.errors.forEach((val) => {
+ this.notify.success("Password Reset", val);
+ });
+ });
+ } else {
+ this.notify.error("Not Setup", "Sorry but the administrator has not set up email notitfications!");
return;
}
- this.identityService.submitResetPassword(form.value.email).subscribe(x => {
- x.errors.forEach((val) => {
- this.notify.success("Password Reset", val);
- });
- });
}
}