diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index ef722cdd2a3..ae656e471f9 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -400,20 +400,34 @@ if (isset($conf->file->main_authentication) && preg_match('/google/', $conf->fil
-
- /', $message)) { // if it contains this comment, this is a warning message
- $message = str_replace('', '', $message);
- print '
';
+ if (!empty($conf->use_javascript_ajax)) {
+ if (preg_match('//', $message)) { // if it contains this comment, this is a warning message
+ $message = str_replace('', '', $message);
+ dol_htmloutput_mesg($message, array(), 'warning');
+ } else {
+ dol_htmloutput_mesg($message, array(), 'error');
+ }
+ print '';
} else {
- print '
';
+ ?>
+
+ /', $message)) { // if it contains this comment, this is a warning message
+ $message = str_replace('', '', $message);
+ print '
';
+ } else {
+ print '
';
+ }
+ print dol_escape_htmltag($message);
+ print '
'; ?>
+
+ '; ?>
-
-