Skip to content
Snippets Groups Projects
Verified Commit a167c869 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #8489 fix admin sendmail

parent 5947163b
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@
<menu-nav></menu-nav>
<mat-nav-list>
<h3 mat-subheader>{{lang.actions}}</h3>
<a mat-list-item *ngIf="sendmail.host.length > 0" (click)="snav2.toggle()">
<a mat-list-item (click)="snav2.toggle();">
<mat-icon color="primary" mat-list-icon class="fas fa-signal"></mat-icon>
<p mat-line>
{{lang.checkSendmail}}
......@@ -26,7 +26,7 @@
<div class="col-md-12" style="margin-bottom: 20px;">
<mat-form-field>
<mat-select #smtpType (selectionChange)="changeDesc(smtpType)" name="smtpType"
placeholder="Type de configuration" [(ngModel)]="sendmail.type">
placeholder="Type de configuration" [(ngModel)]="sendmail.type" required>
<mat-option *ngFor="let type of smtpTypeList" [value]="type.id">
{{type.label}}
</mat-option>
......@@ -38,8 +38,8 @@
<div class="form-group" [style.opacity]="sendmail.type != 'smtp' ? '0.5' : '1'">
<div class="col-md-2">
<mat-form-field>
<mat-select name="SMTPSecure" placeholder="Méthode d'authentification"
[disabled]="sendmail.type != 'smtp'" [(ngModel)]="sendmail.secure">
<mat-select name="SMTPSecure" placeholder="{{lang.smtpAuth}}"
[disabled]="sendmail.type != 'smtp'" [(ngModel)]="sendmail.secure" required>
<mat-option *ngFor="let security of smtpSecList" [value]="security">
{{security}}
</mat-option>
......@@ -49,13 +49,13 @@
<div class="col-md-9">
<mat-form-field>
<input matInput name="host" [disabled]="sendmail.type != 'smtp'"
[(ngModel)]="sendmail.host" placeholder="{{lang.host}}">
[(ngModel)]="sendmail.host" placeholder="{{lang.host}}" required>
</mat-form-field>
</div>
<div class="col-md-1">
<mat-form-field>
<input name="port" type="number" matInput [(ngModel)]="sendmail.port"
[disabled]="sendmail.type != 'smtp'" placeholder="{{lang.port}}">
[disabled]="sendmail.type != 'smtp'" placeholder="{{lang.port}}" required>
</mat-form-field>
</div>
</div>
......@@ -69,14 +69,14 @@
<div class="col-md-12">
<mat-form-field>
<input name="user" [(ngModel)]="sendmail.user" [disabled]="!sendmail.auth || sendmail.type != 'smtp'"
matInput placeholder="{{lang.id}}">
matInput placeholder="{{lang.id}}" required>
</mat-form-field>
</div>
<div class="col-md-12">
<mat-form-field>
<input name="password" [type]="hidePassword ? 'password' : 'text'" [(ngModel)]="sendmail.password"
[disabled]="!sendmail.auth || sendmail.type != 'smtp'" matInput
placeholder="{{lang.password}}">
placeholder="{{lang.password}}" required>
<mat-icon color="primary" style="cursor: pointer;" matSuffix (click)="hidePassword = !hidePassword"
class="fa fa-2x" [ngClass]="[hidePassword ? 'fa-eye-slash' : 'fa-eye']"></mat-icon>
</mat-form-field>
......@@ -91,7 +91,7 @@
</div>
</div>
<div class="col-md-12 text-center" style="padding:10px;">
<button mat-raised-button type="submit" color="primary" [disabled]="checkModif()">{{lang.validate}}</button>
<button mat-raised-button type="submit" color="primary" [disabled]="checkModif() || !sendmailForm.valid">{{lang.validate}}</button>
<button mat-raised-button type="button" color="default" [disabled]="checkModif()"
(click)="cancelModification()">{{lang.cancel}}</button>
</div>
......@@ -102,13 +102,13 @@
</mat-sidenav-content>
<mat-sidenav #snav2 [mode]="mobileQuery.matches ? 'over' : 'side'" [fixedInViewport]="mobileQuery.matches"
fixedTopGap="56" position='end' [opened]="mobileQuery.matches ? false : false" style="overflow-x:hidden;width:500px;"
(opened)="initEmailSend()">
(opened)="onSubmit();initEmailSend()">
<mat-nav-list disableRipple="true">
<h3 mat-subheader>{{lang.emailSendTest}}</h3>
<div class="form-group" [style.opacity]="sendmail.type != 'smtp' ? '0.5' : '1'">
<div class="col-md-12">
<mat-form-field>
<input matInput placeholder="Adresse d'envoi" [(ngModel)]="currentUser.mail" [disabled]="emailSendLoading">
<input matInput placeholder="Adresse d'envoi" [(ngModel)]="recipientTest" [disabled]="emailSendLoading">
<mat-icon *ngIf="!emailSendLoading" title="{{lang.beginSendTest}}" (click)="testEmailSend()" color="primary" style="cursor: pointer;" matSuffix
class="fa fa-paper-plane fa-2x"></mat-icon>
</mat-form-field>
......
......@@ -65,6 +65,7 @@ export class SendmailAdministrationComponent implements OnInit {
msg : ''
};
currentUser: any = {};
recipientTest: string = '';
......@@ -76,7 +77,7 @@ export class SendmailAdministrationComponent implements OnInit {
}
ngOnInit(): void {
this.headerService.setHeader(this.lang.sendmail);
this.headerService.setHeader(this.lang.sendmailShort);
window['MainHeaderComponent'].setSnav(this.sidenavLeft);
window['MainHeaderComponent'].setSnavRight(null);
......@@ -125,6 +126,7 @@ export class SendmailAdministrationComponent implements OnInit {
this.http.get('../../rest/currentUser/profile')
.subscribe((data: any) => {
this.currentUser = data;
this.recipientTest = data.mail;
});
}
}
......@@ -136,7 +138,7 @@ export class SendmailAdministrationComponent implements OnInit {
};
let email = {
"sender": { "email": this.currentUser.mail },
"recipients": [this.currentUser.mail],
"recipients": [this.recipientTest],
"object": "test mail envoi",
"status": "SENDMAILTEST",
"body": "test mail envoi",
......
......@@ -363,6 +363,7 @@ export const LANG_EN = {
"selectAll" : "Select all",
"selectedDocumentStatus" : "Document status selected",
"sendmail" : "Sendmail",
"sendmailShort" : "Sendmail",
"sendTo" : "Send to",
"shortLabel" : "Short label",
"signatures" : "Signatures",
......@@ -735,6 +736,7 @@ export const LANG_EN = {
"isMulticontact" : "Multi-contact",
"emailSendTest" : "Email send test",
"beginSendTest" : "Begin send test",
"emailSendSuccess" : "Email sent",
"emailSendInProgress" : "Sending email...",
"emailSendSuccess" : "Email sent",
"emailSendInProgress" : "Sending email...",
"smtpAuth" : "Authentication methode",
};
......@@ -453,6 +453,7 @@ export const LANG_FR = {
"selectAll" : "Sélectionner tout",
"selectedDocumentStatus" : "Statut du document à prendre en compte",
"sendmail" : "Envoi de courriels et plis numériques",
"sendmailShort" : "Envoi de courriels",
"sendTo" : "Envoyer à",
"september" : "Septembre",
"septemberShort" : "Sept.",
......@@ -762,7 +763,8 @@ export const LANG_FR = {
"emailSendTest" : "Test d'envoi",
"beginSendTest" : "Commencer le test",
"emailSendSuccess" : "Envoi réussi",
"emailSendInProgress" : "En cours d'envoi",
"emailSendInProgress" : "En cours d'envoi...",
"smtpAuth" : "Méthode d'authentification",
};
......@@ -766,4 +766,6 @@ export const LANG_NL = {
"beginSendTest" : "_TO_TRANSLATE",
"emailSendSuccess" : "_TO_TRANSLATE",
"emailSendInProgress" : "_TO_TRANSLATE",
"smtpAuth" : "_TO_TRANSLATE",
"sendmailShort" : "_TO_TRANSLATE",
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment