Skip to content

Commit b834912

Browse files
authored
Merge pull request #186 from Gid733/master
Minor fixes
2 parents d1174f0 + c2787f6 commit b834912

File tree

7 files changed

+30
-6
lines changed

7 files changed

+30
-6
lines changed

eFormAPI/eFormAPI/Controllers/SettingsController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Reflection;
77
using System.Web.Configuration;
88
using System.Web.Http;
9+
using Castle.Core.Internal;
910
using eFormAPI.Web.Infrastructure.Helpers;
1011
using eFormAPI.Web.Infrastructure.Models.Settings.Admin;
1112
using eFormAPI.Web.Infrastructure.Models.Settings.Initial;
@@ -155,7 +156,9 @@ public OperationDataResult<LoginPageSettingsModel> GetLoginPageSettings()
155156
MainText = section.Settings["loginPage:mainText"]?.Value,
156157
MainTextVisible = section.Settings["loginPage:mainTextVisible"].Value.Equals("True"),
157158
SecondaryText = section.Settings["loginPage:secondaryText"]?.Value,
158-
SecondaryTextVisible = section.Settings["loginPage:secondaryTextVisible"].Value.Equals("True")
159+
SecondaryTextVisible = section.Settings["loginPage:secondaryTextVisible"].Value.Equals("True"),
160+
IsSMTPExists = !section.Settings["email:smtpHost"].Value.IsNullOrEmpty() &&
161+
!section.Settings["email:smtpPort"].Value.IsNullOrEmpty()
159162
};
160163
return new OperationDataResult<LoginPageSettingsModel>(true, model);
161164
}

eFormAPI/eFormAPI/Infrastructure/Models/Settings/Admin/LoginPageSettingsModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ public class LoginPageSettingsModel
88
public bool SecondaryTextVisible { get; set; }
99
public string ImageLink { get; set; }
1010
public bool ImageLinkVisible { get; set; }
11+
public bool IsSMTPExists { get; set; }
1112
}
1213
}

eform-client/src/app/common/models/settings/login-page-settings.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export class LoginPageSettingsModel {
55
secondaryTextVisible: boolean;
66
imageLink: string;
77
imageLinkVisible: boolean;
8+
isSMTPExists: boolean;
89
}

eform-client/src/app/common/services/app-settings/app-settings.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const SettingsMethods = {
3030

3131
@Injectable()
3232
export class AppSettingsService extends BaseService {
33+
loginPageSettingsModel: LoginPageSettingsModel = new LoginPageSettingsModel();
3334
private headers: Headers;
3435

3536
constructor(private _http: HttpClient, router: Router, toastrService: ToastrService) {

eform-client/src/app/modules/auth/components/auth/auth.component.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,38 @@ export class AuthComponent implements OnInit {
2424

2525
ngOnInit() {
2626
this.localeService.initLocale();
27+
this.checkConnectionString();
28+
}
29+
30+
checkConnectionString() {
31+
if (!this.isConnectionStringExist(false)) {
32+
setTimeout(() => {
33+
this.isConnectionStringExist(true);
34+
}, 5000);
35+
}
36+
}
37+
38+
isConnectionStringExist(secondCheck: boolean) {
2739
this.spinnerStatus = true;
2840
this.settingsService.connectionStringExist().subscribe((result) => {
2941
if (result && !result.success) {
30-
this.router.navigate(['/application-settings/connection-string']).then();
42+
if (secondCheck) {
43+
this.router.navigate(['/application-settings/connection-string']).then();
44+
}
45+
return false;
3146
} else if (result && result.success) {
3247
this.getSettings();
3348
this.getTwoFactorInfo();
3449
} this.spinnerStatus = false;
35-
});
50+
return true;
51+
}, error => false);
3652
}
3753

3854
getSettings() {
3955
this.spinnerStatus = true;
4056
this.settingsService.getLoginPageSettings().subscribe((data) => {
4157
if (data && data.success) {
42-
this.loginPageSettings = data.model;
58+
this.loginPageSettings = this.settingsService.loginPageSettingsModel = data.model;
4359
if (this.loginPageSettings.imageLink && this.loginPageSettings.imageLinkVisible) {
4460
this.loginImage = 'api/images/login-page-images?fileName=' + this.loginPageSettings.imageLink;
4561
} else if (!this.loginPageSettings.imageLink) {

eform-client/src/app/modules/auth/components/auth/login/login.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
</form>
2727
<eform-spinner [spinnerVisibility]="spinnerStatus"></eform-spinner>
2828
</div>
29-
<a class="link-primary" [routerLink]="['restore-password']">{{'Forgot password' | translate}}?</a>
29+
<a class="link-primary" [routerLink]="['restore-password']" *ngIf="settingsService.loginPageSettingsModel.isSMTPExists">
30+
{{'Forgot password' | translate}}?
31+
</a>
3032

3133

eform-client/src/app/modules/auth/components/auth/login/login.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class LoginComponent implements OnInit {
3030

3131
constructor(private router: Router,
3232
private authService: AuthService,
33-
private settingsService: AppSettingsService,
33+
public settingsService: AppSettingsService,
3434
private fb: FormBuilder,
3535
private toastrService: ToastrService,
3636
private localeService: LocaleService,

0 commit comments

Comments
 (0)