diff --git a/src/frontend/app/administration/sendmail/sendmail-administration.component.html b/src/frontend/app/administration/sendmail/sendmail-administration.component.html index 6ef8191613c2e50031e25c960c2772fb8d83cdda..6978ab740668c48ac6ed152fbf11df8f303c939b 100644 --- a/src/frontend/app/administration/sendmail/sendmail-administration.component.html +++ b/src/frontend/app/administration/sendmail/sendmail-administration.component.html @@ -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="{{lang.smtpAuth}}" - [disabled]="sendmail.type != 'smtp'" [(ngModel)]="sendmail.secure" required> + <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> @@ -48,8 +48,8 @@ </div> <div class="col-md-9"> <mat-form-field> - <input matInput name="host" [disabled]="sendmail.type != 'smtp'" - [(ngModel)]="sendmail.host" placeholder="{{lang.host}}" required> + <input matInput name="host" [disabled]="sendmail.type != 'smtp'" [(ngModel)]="sendmail.host" + placeholder="{{lang.host}}" required> </mat-form-field> </div> <div class="col-md-1"> @@ -75,8 +75,7 @@ <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}}" required> + [disabled]="!sendmail.auth || sendmail.type != 'smtp'" matInput placeholder="{{passwordLabel}}"> <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> @@ -103,22 +102,25 @@ <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)="onSubmit();initEmailSend()"> - <mat-nav-list disableRipple="true"> + <mat-nav-list disableRipple="true" style="display: flex;flex-direction: column;"> <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="{{lang.mailTo}}" [(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-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> </div> </div> <mat-list-item *ngIf="emailSendResult.msg != ''"> - <mat-icon mat-list-icon class= "fas {{emailSendResult.icon}} fa-2x"></mat-icon> + <mat-icon mat-list-icon class="fas {{emailSendResult.icon}} fa-2x"></mat-icon> <p mat-line> {{emailSendResult.msg}} </p> </mat-list-item> </mat-nav-list> + <div class="bash" *ngIf="this.emailSendResult.msg === lang.emailSendFailed"> + {{this.emailSendResult.debug}} + </div> </mat-sidenav> </mat-sidenav-container> </div> \ No newline at end of file diff --git a/src/frontend/app/administration/sendmail/sendmail-administration.component.scss b/src/frontend/app/administration/sendmail/sendmail-administration.component.scss index 5cfcf4c8c618225f07b2a1a7afe18b2d990b22ea..3a58dfdfa9fa9a509b5d847e860fbc06892bf027 100644 --- a/src/frontend/app/administration/sendmail/sendmail-administration.component.scss +++ b/src/frontend/app/administration/sendmail/sendmail-administration.component.scss @@ -8,4 +8,19 @@ .primary { color : #135f7f; -} \ No newline at end of file +} + +.red { + color: red; +} + +.bash { + background : #34495e; + height : 310px ; + border-radius : 5px ; + top: 40px; + display : absolute; + color : #fff ; + padding: 10px; + margin: 10px; + } \ No newline at end of file diff --git a/src/frontend/app/administration/sendmail/sendmail-administration.component.ts b/src/frontend/app/administration/sendmail/sendmail-administration.component.ts index 90304f79d233729b1a2db89b82646013a003609a..f4014c844a54b4aba6409a4c86b1929bcbd15b32 100644 --- a/src/frontend/app/administration/sendmail/sendmail-administration.component.ts +++ b/src/frontend/app/administration/sendmail/sendmail-administration.component.ts @@ -61,11 +61,13 @@ export class SendmailAdministrationComponent implements OnInit { serverConnectionLoading: boolean = false; emailSendLoading: boolean = false; emailSendResult = { - icon : '', - msg : '' + icon: '', + msg: '', + debug : '' }; currentUser: any = {}; recipientTest: string = ''; + passwordLabel: string = ''; @@ -89,6 +91,12 @@ export class SendmailAdministrationComponent implements OnInit { this.sendmail = data.configuration.value this.sendmailClone = JSON.parse(JSON.stringify(this.sendmail)); this.smtpTypeDesc = this.lang[this.sendmail.type + 'Desc']; + if (this.sendmail.passwordAlreadyExists === true) { + this.passwordLabel = this.lang.passwordModification; + } else { + this.passwordLabel = this.lang.password; + } + this.loading = false; }, (err) => { this.notify.handleErrors(err); @@ -119,29 +127,31 @@ export class SendmailAdministrationComponent implements OnInit { initEmailSend() { this.emailSendResult = { - icon : '', - msg : '' + icon: '', + msg: '', + debug: '', }; if (this.currentUser.mail === undefined) { this.http.get('../../rest/currentUser/profile') - .subscribe((data: any) => { - this.currentUser = data; - this.recipientTest = data.mail; - }); - } + .subscribe((data: any) => { + this.currentUser = data; + this.recipientTest = data.mail; + }); + } } testEmailSend() { this.emailSendResult = { - icon : 'fa-paper-plane primary', - msg : this.lang.emailSendInProgress + icon: 'fa-paper-plane primary', + msg: this.lang.emailSendInProgress, + debug: '' }; let email = { "sender": { "email": this.currentUser.mail }, "recipients": [this.recipientTest], - "object": "test mail envoi", + "object": "[" + this.lang.doNotReply +"] " + this.lang.emailSendTest, "status": "SENDMAILTEST", - "body": "test mail envoi", + "body": this.lang.emailSendTest, "isHtml": false } this.emailSendLoading = true; @@ -150,8 +160,16 @@ export class SendmailAdministrationComponent implements OnInit { .subscribe((data: any) => { this.emailSendLoading = false; this.emailSendResult = { - icon : 'fa-check green', - msg : this.lang.emailSendSuccess + icon: 'fa-check green', + msg: this.lang.emailSendSuccess, + debug: '' + }; + }, (err) => { + this.emailSendLoading = false; + this.emailSendResult = { + icon: 'fa-times red', + msg: this.lang.emailSendFailed, + debug: err.error.errors }; }); } diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index 3b981745b63a5077a2565a4c3eeb1114c444c8ed..5eecdd943be551d268e7643a0a0aa52584d12b1b 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -740,4 +740,6 @@ export const LANG_EN = { "emailSendSuccess" : "Email sent", "emailSendInProgress" : "Sending email...", "smtpAuth" : "Authentication methode", + "emailSendFailed" : "Email send failed", + "doNotReply" : "Do not reply", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index f3731aa844fcd014ac6bd4d038c29e0f3215d236..ce26afbe10bdfc3439edb8a1bd395c390445b24d 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -766,6 +766,8 @@ export const LANG_FR = { "emailSendSuccess" : "Envoi réussi", "emailSendInProgress" : "En cours d'envoi...", "smtpAuth" : "Méthode d'authentification", + "emailSendFailed" : "Échec d'envoi", + "doNotReply" : "Ne pas répondre", }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 3d6de2e89e6df5bfe88af745e22f04506f3a72fa..700168f41752b4cb90232ff3ebb10ebc3863a863 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -769,4 +769,6 @@ export const LANG_NL = { "emailSendInProgress" : "_TO_TRANSLATE", "smtpAuth" : "_TO_TRANSLATE", "sendmailShort" : "_TO_TRANSLATE", + "emailSendFailed" : "_TO_TRANSLATE", + "doNotReply" : "_TO_TRANSLATE", };