diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index ef722cdd2a3fe..ae656e471f97a 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -400,20 +400,34 @@
-
- /', $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 '
'; ?>
+
+ '; ?>
-
-