Commit 9e9461100469eec436ad13ef89bb6f116521698b

Authored by Igor Kulikov
1 parent a054be36

Improve mail server settings

... ... @@ -76,10 +76,10 @@
76 76 {{ 'admin.timeout-invalid' | translate }}
77 77 </mat-error>
78 78 </mat-form-field>
79   - <tb-checkbox formControlName="enableTls" trueValue="true" falseValue="false" style="display: block; padding-bottom: 16px;">
  79 + <tb-checkbox formControlName="enableTls" style="display: block; padding-bottom: 16px;">
80 80 {{ 'admin.enable-tls' | translate }}
81 81 </tb-checkbox>
82   - <mat-form-field class="mat-block" *ngIf="mailSettings.get('enableTls').value === 'true'">
  82 + <mat-form-field class="mat-block" *ngIf="mailSettings.get('enableTls').value">
83 83 <mat-label translate>admin.tls-version</mat-label>
84 84 <mat-select formControlName="tlsVersion">
85 85 <mat-option *ngFor="let tlsVersion of tlsVersions" [value]="tlsVersion">
... ...
... ... @@ -25,6 +25,7 @@ import { AdminService } from '@core/http/admin.service';
25 25 import { ActionNotificationShow } from '@core/notification/notification.actions';
26 26 import { TranslateService } from '@ngx-translate/core';
27 27 import { HasConfirmForm } from '@core/guards/confirm-on-exit.guard';
  28 +import { isString } from '@core/utils';
28 29
29 30 @Component({
30 31 selector: 'tb-mail-server',
... ... @@ -52,6 +53,9 @@ export class MailServerComponent extends PageComponent implements OnInit, HasCon
52 53 this.adminService.getAdminSettings<MailServerSettings>('mail').subscribe(
53 54 (adminSettings) => {
54 55 this.adminSettings = adminSettings;
  56 + if (this.adminSettings.jsonValue && isString(this.adminSettings.jsonValue.enableTls)) {
  57 + this.adminSettings.jsonValue.enableTls = (this.adminSettings.jsonValue.enableTls as any) === 'true';
  58 + }
55 59 this.mailSettings.reset(this.adminSettings.jsonValue);
56 60 this.enableProxyChanged();
57 61 }
... ... @@ -69,7 +73,7 @@ export class MailServerComponent extends PageComponent implements OnInit, HasCon
69 73 timeout: ['10000', [Validators.required,
70 74 Validators.pattern(/^[0-9]{1,6}$/),
71 75 Validators.maxLength(6)]],
72   - enableTls: ['false'],
  76 + enableTls: [false],
73 77 tlsVersion: [],
74 78 enableProxy: [false, []],
75 79 proxyHost: ['', [Validators.required]],
... ...