2019-08-12 19:34:23 +03:00
|
|
|
<!--
|
|
|
|
|
|
2023-01-31 10:43:56 +02:00
|
|
|
Copyright © 2016-2023 The Thingsboard Authors
|
2019-08-12 19:34:23 +03:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
|
|
|
|
|
-->
|
|
|
|
|
<div>
|
2023-02-17 19:24:01 +02:00
|
|
|
<mat-card appearance="outlined" class="settings-card">
|
2019-08-12 19:34:23 +03:00
|
|
|
<mat-card-title>
|
|
|
|
|
<div fxLayout="row">
|
2023-02-17 19:24:01 +02:00
|
|
|
<span class="mat-headline-5" translate>admin.outgoing-mail-settings</span>
|
2019-08-12 19:34:23 +03:00
|
|
|
<span fxFlex></span>
|
|
|
|
|
<div tb-help="outgoingMailSettings"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-card-title>
|
|
|
|
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
|
|
|
|
|
</mat-progress-bar>
|
|
|
|
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
|
|
|
|
<mat-card-content style="padding-top: 16px;">
|
2020-04-27 10:39:18 +03:00
|
|
|
<form [formGroup]="mailSettings" (ngSubmit)="save()">
|
2019-08-12 19:34:23 +03:00
|
|
|
<fieldset [disabled]="isLoading$ | async">
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.mail-from</mat-label>
|
|
|
|
|
<input matInput formControlName="mailFrom" required/>
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('mailFrom').hasError('required')">
|
|
|
|
|
{{ 'admin.mail-from-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.smtp-protocol</mat-label>
|
2021-07-29 16:45:14 +03:00
|
|
|
<mat-select formControlName="smtpProtocol">
|
2019-08-12 19:34:23 +03:00
|
|
|
<mat-option *ngFor="let protocol of smtpProtocols" [value]="protocol">
|
|
|
|
|
{{protocol.toUpperCase()}}
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<div fxLayout.gt-sm="row" fxLayoutGap.gt-sm="10px">
|
|
|
|
|
<mat-form-field class="mat-block" fxFlex="100" fxFlex.gt-sm="60">
|
|
|
|
|
<mat-label translate>admin.smtp-host</mat-label>
|
|
|
|
|
<input matInput formControlName="smtpHost" placeholder="localhost" required/>
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('smtpHost').hasError('required')">
|
|
|
|
|
{{ 'admin.smtp-host-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field class="mat-block" fxFlex="100" fxFlex.gt-sm="40">
|
|
|
|
|
<mat-label translate>admin.smtp-port</mat-label>
|
|
|
|
|
<input matInput #smtpPortInput formControlName="smtpPort" placeholder="25" maxlength="5" required/>
|
|
|
|
|
<mat-hint align="end">{{smtpPortInput.value?.length || 0}}/5</mat-hint>
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('smtpPort').hasError('required')">
|
|
|
|
|
{{ 'admin.smtp-port-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('smtpPort').hasError('pattern') || mailSettings.get('smtpPort').hasError('maxlength')">
|
|
|
|
|
{{ 'admin.smtp-port-invalid' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.timeout-msec</mat-label>
|
|
|
|
|
<input matInput #timeoutInput formControlName="timeout" placeholder="10000" maxlength="6" required/>
|
|
|
|
|
<mat-hint align="end">{{timeoutInput.value?.length || 0}}/6</mat-hint>
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('timeout').hasError('required')">
|
|
|
|
|
{{ 'admin.timeout-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('timeout').hasError('pattern') || mailSettings.get('timeout').hasError('maxlength')">
|
|
|
|
|
{{ 'admin.timeout-invalid' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
2020-06-01 15:22:42 +03:00
|
|
|
<tb-checkbox formControlName="enableTls" style="display: block; padding-bottom: 16px;">
|
2019-08-12 19:34:23 +03:00
|
|
|
{{ 'admin.enable-tls' | translate }}
|
|
|
|
|
</tb-checkbox>
|
2020-06-01 15:22:42 +03:00
|
|
|
<mat-form-field class="mat-block" *ngIf="mailSettings.get('enableTls').value">
|
2020-02-20 18:50:00 +02:00
|
|
|
<mat-label translate>admin.tls-version</mat-label>
|
|
|
|
|
<mat-select formControlName="tlsVersion">
|
|
|
|
|
<mat-option *ngFor="let tlsVersion of tlsVersions" [value]="tlsVersion">
|
|
|
|
|
{{ tlsVersion }}
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
</mat-form-field>
|
2020-06-01 01:34:26 +03:00
|
|
|
<tb-checkbox formControlName="enableProxy" style="display: block; padding-bottom: 16px;">
|
|
|
|
|
{{ 'admin.enable-proxy' | translate }}
|
|
|
|
|
</tb-checkbox>
|
2020-06-01 14:44:24 +03:00
|
|
|
<div *ngIf="mailSettings.get('enableProxy').value">
|
|
|
|
|
<div fxLayout.gt-sm="row" fxLayoutGap.gt-sm="8px">
|
2020-06-01 14:05:01 +03:00
|
|
|
<mat-form-field class="mat-block" fxFlex="100" fxFlex.gt-sm="60">
|
|
|
|
|
<mat-label translate>admin.proxy-host</mat-label>
|
|
|
|
|
<input matInput required formControlName="proxyHost">
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('proxyHost').hasError('required')">
|
|
|
|
|
{{ 'admin.proxy-host-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field class="mat-block" fxFlex="100" fxFlex.gt-sm="40">
|
|
|
|
|
<mat-label translate>admin.proxy-port</mat-label>
|
|
|
|
|
<input matInput required formControlName="proxyPort" type="number" step="1" min="1" max="65535">
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('proxyPort').hasError('required')">
|
|
|
|
|
{{ 'admin.proxy-port-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="mailSettings.get('proxyPort').hasError('pattern')
|
|
|
|
|
|| mailSettings.get('proxyPort').hasError('min')
|
|
|
|
|
|| mailSettings.get('proxyPort').hasError('max')">
|
|
|
|
|
{{ 'admin.proxy-port-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.proxy-user</mat-label>
|
|
|
|
|
<input matInput formControlName="proxyUser">
|
2020-06-01 01:34:26 +03:00
|
|
|
</mat-form-field>
|
2020-06-01 14:05:01 +03:00
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.proxy-password</mat-label>
|
2020-07-24 10:45:50 +03:00
|
|
|
<input matInput type="password" formControlName="proxyPassword" autocomplete="new-proxy-password">
|
2021-08-02 12:55:34 +03:00
|
|
|
<tb-toggle-password matSuffix></tb-toggle-password>
|
2020-06-01 01:34:26 +03:00
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
2019-08-12 19:34:23 +03:00
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>common.username</mat-label>
|
2020-07-24 10:45:50 +03:00
|
|
|
<input matInput formControlName="username" placeholder="{{ 'common.enter-username' | translate }}"
|
|
|
|
|
autocomplete="new-username"/>
|
2019-08-12 19:34:23 +03:00
|
|
|
</mat-form-field>
|
2021-07-30 15:15:24 +03:00
|
|
|
<mat-checkbox *ngIf="showChangePassword" formControlName="changePassword" style="padding-bottom: 16px;">
|
2021-07-29 16:45:14 +03:00
|
|
|
{{ 'admin.change-password' | translate }}
|
|
|
|
|
</mat-checkbox>
|
2021-07-30 15:15:24 +03:00
|
|
|
<mat-form-field class="mat-block" *ngIf="mailSettings.get('changePassword').value || !showChangePassword">
|
2019-08-12 19:34:23 +03:00
|
|
|
<mat-label translate>common.password</mat-label>
|
2020-07-24 10:45:50 +03:00
|
|
|
<input matInput formControlName="password" type="password"
|
|
|
|
|
placeholder="{{ 'common.enter-password' | translate }}" autocomplete="new-password"/>
|
2021-08-02 12:55:34 +03:00
|
|
|
<tb-toggle-password matSuffix></tb-toggle-password>
|
2019-08-12 19:34:23 +03:00
|
|
|
</mat-form-field>
|
2020-04-02 11:01:13 +03:00
|
|
|
<div fxLayout="row" fxLayoutAlign="end center" fxLayout.xs="column" fxLayoutAlign.xs="end" fxLayoutGap="16px">
|
|
|
|
|
<button mat-raised-button type="button"
|
2020-04-27 10:39:18 +03:00
|
|
|
[disabled]="(isLoading$ | async) || mailSettings.invalid" (click)="sendTestMail()">
|
2019-08-12 19:34:23 +03:00
|
|
|
{{'admin.send-test-mail' | translate}}
|
|
|
|
|
</button>
|
2020-04-27 10:39:18 +03:00
|
|
|
<button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || mailSettings.invalid || !mailSettings.dirty"
|
2019-08-12 19:34:23 +03:00
|
|
|
type="submit">{{'action.save' | translate}}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
</form>
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</mat-card>
|
|
|
|
|
</div>
|