Commit 12a0b6be authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FEAT #17005 TIME 2:30 customize the message in the login page

parent 42827796
......@@ -511,6 +511,16 @@
"mergedVariablesMsg": "Use tag",
"mergedVariablesMsg2": "to display the generated security code.",
"mergedVariablesMsgEmail": "You can use the different tags below to enrich your email",
"updateOtp": "Update external user"
"updateOtp": "Update external user",
"smsCodeTagMandatory": "The <b> code </b> tag is required to send security code by SMS",
"emailLinkTagMandatory": "The <b> access link </b> tag is required for email notification",
"manage_customization": "Customization",
"manage_customizationDesc": "Customize the message on the login screen",
"loginMessage": "Message on the login page:",
"customization": "Customization",
"noConnector": "The associated connector does not exist",
"otpVisaUser": "The user will be notified by <b> email </b> at the time of his turn in the workflow.",
"messageSaved": "Message saved",
"manage_customizationAdmin": "Customize the login page"
}
}
\ No newline at end of file
......@@ -517,6 +517,8 @@
"loginMessage": "Message à l'écran de connexion :",
"customization": "Personnalisation",
"noConnector": "Le connecteur associé n'existe pas",
"otpVisaUser": "L'utilisateur sera notifié par <b>courriel</b> au moment de son tour dans le circuit."
"otpVisaUser": "L'utilisateur sera notifié par <b>courriel</b> au moment de son tour dans le circuit.",
"messageSaved": "Message enregistré",
"manage_customizationAdmin": "Personnaliser la page de connexion"
}
}
......@@ -15,7 +15,9 @@
</ion-label>
</ion-list-header>
<ion-item lines="none">
<textarea style="padding-top: 10px;width: 100%;" name="login_message" id="login_message" [(ngModel)]="authService.loginMessage"></textarea>
<textarea style="padding-top: 10px;width: 100%;" name="login_message" id="login_message"
[value]="loginMessage" [(ngModel)]="loginMessage">
</textarea>
</ion-item>
<ion-item text-center lines="none" style="position: sticky;bottom:0px;z-index:1;">
<div style="display: flex;align-items: center;justify-content: center;width: 100%;background: white;">
......
......@@ -20,7 +20,7 @@ export class CustomizationComponent implements OnInit {
@ViewChild('customizationForm', { static: false }) customizationForm: NgForm;
loading: boolean = true;
loginMessage: string = '<span style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;">D&eacute;couvrez&nbsp;</span><strong style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;">Maarch Parapheur 21.03</strong><span style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;">&nbsp;avec&nbsp;</span><a style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;" title="notre guide de visite" href="https://docs.maarch.org/" target="_blank" rel="noopener"><span style="color: #f99830;"><strong>notre guide de visite en ligne</strong></span></a><span style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;">.</span>';
loginMessage: string = '';
constructor(
public http: HttpClient,
......@@ -30,24 +30,48 @@ export class CustomizationComponent implements OnInit {
private functions: FunctionsService
) { }
ngOnInit(){
// await this.authService.getLoginMessage();
setTimeout(() => {
this.initMce();
}, 100);
this.loading = false;
async ngOnInit(){
await this.getLginMessage();
}
ngOnDestroy(): void {
tinymce.remove();
}
getLginMessage() {
return new Promise((resolve) => {
this.http.get('../rest/authenticationInformations').pipe(
tap((data: any) => {
this.loginMessage = data.loginMessage;
setTimeout(() => {
this.initMce();
}, 100);
this.loading = false;
resolve(true);
}),
catchError((err: any) => {
this.notificationService.error(err);
return of(false);
})
).subscribe();
})
}
onSubmit() {
this.loginMessage = tinymce.get('login_message').getContent();
console.log(this.loginMessage);
// this.http.post('../res/', this.loginMessage).pipe(
// tap(() => {}),
// catchError((err: any) => {
// this.notificationService.handleErrors(err);
// return of(false);
// })
// ).subscribe();
if (this.functions.empty(this.loginMessage)) {
this.notificationService.error(this.translate.instant('lang.requiredField'));
} else {
this.http.put('../rest/customization', {id: this.authService.user.id , loginMessage: this.loginMessage}).pipe(
tap(() => {
this.notificationService.success(this.translate.instant('lang.messageSaved'));
}),
catchError((err: any) => {
this.notificationService.handleErrors(err);
return of(false);
})
).subscribe();
}
}
initMce() {
......
......@@ -36,6 +36,7 @@ export class AuthGuard implements CanActivate {
} else {
this.http.get('../rest/authenticationInformations').pipe(
map((data: any) => {
this.authService.loginMessage = data.loginMessage;
this.authService.authMode = data.connection;
this.authService.changeKey = data.changeKey;
this.authService.coreUrl = data.coreUrl;
......
......@@ -19,7 +19,7 @@ export class AuthService {
user: any = {};
signatureRoles: any[] = [];
mailServerOnline = false;
loginMessage: string = '<span style="color: #000000;"><span style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;">D&eacute;couvrez&nbsp;</span><strong style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;">Maarch Parapheur 21.03</strong></span><span style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;"><span style="color: #000000;">&nbsp;avec</span>&nbsp;</span><a style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;" title="notre guide de visite" href="https://docs.maarch.org/" target="_blank" rel="noopener"><span style="color: #f99830;"><strong>notre guide de visite en ligne</strong></span></a><span style="font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif;">.</span>';
loginMessage: string = '';
constructor(public http: HttpClient,
private router: Router,
......@@ -159,18 +159,4 @@ export class AuthService {
cleanCachedUrl() {
return this.localStorage.remove('MaarchParapheurCacheUrl');
}
getLoginMessage() {
return new Promise((resolve) => {
this.http.get('../rest/adminCustomization').pipe(
tap(() => {
resolve(true);
}),
catchError((err: any) => {
this.notificationService.handleErrors(err);
return of(false);
})
).subscribe();
});
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment