diff --git a/approot/messages_fr.xml b/approot/messages_fr.xml
index 0a2690f8..89ff1ce3 100644
--- a/approot/messages_fr.xml
+++ b/approot/messages_fr.xml
@@ -128,5 +128,12 @@
Invalide
Mot de passe invalide
+Trop court
+Trop long
+Pas assez de caractères ou de classes différentes pour cette longueur de mot de passe
+Pas assez de caractères ou de classes différentes
+Basé sur des informations personnelles
+Basé sur un mot de dictionnaire
+Basé sur une séquence de caractères
diff --git a/src/ui/LmsApplication.cpp b/src/ui/LmsApplication.cpp
index 2116765e..a37e2395 100644
--- a/src/ui/LmsApplication.cpp
+++ b/src/ui/LmsApplication.cpp
@@ -537,6 +537,11 @@ LmsApplication::post(std::function func)
Wt::WServer::instance()->post(LmsApp->sessionId(), func);
}
+static std::string escape(std::string str)
+{
+ return replaceInString(std::move(str), "\'", "\\\'");
+}
+
void
LmsApplication::notifyMsg(MsgType type, const Wt::WString& message, std::chrono::milliseconds duration)
{
@@ -545,7 +550,7 @@ LmsApplication::notifyMsg(MsgType type, const Wt::WString& message, std::chrono:
std::ostringstream oss;
oss << "$.notify({"
- "message: '" << message.toUTF8() << "'"
+ "message: '" << escape(message.toUTF8()) << "'"
"},{"
"type: '" << msgTypeToString(type) << "',"
"placement: {from: 'top', align: 'center'},"
diff --git a/src/ui/admin/UsersView.cpp b/src/ui/admin/UsersView.cpp
index fbddd2e2..b3e249d4 100644
--- a/src/ui/admin/UsersView.cpp
+++ b/src/ui/admin/UsersView.cpp
@@ -114,7 +114,8 @@ UsersView::refreshView()
user.remove();
_container->removeWidget(entry);
}
- delBtn->removeChild(msgBox);
+ else
+ delBtn->removeChild(msgBox);
});
msgBox->show();
diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp
index f7864cb1..57704eac 100644
--- a/src/utils/Utils.cpp
+++ b/src/utils/Utils.cpp
@@ -102,3 +102,18 @@ bufferToString(const std::vector& data)
return oss.str();
}
+std::string
+replaceInString(std::string str, const std::string& from, const std::string& to)
+{
+ size_t pos = 0;
+
+ while ((pos = str.find(from, pos)) != std::string::npos)
+ {
+ str.replace(pos, from.length(), to);
+ pos += to.length();
+ }
+
+ return str;
+}
+
+
diff --git a/src/utils/Utils.hpp b/src/utils/Utils.hpp
index cba5fe91..287a62e4 100644
--- a/src/utils/Utils.hpp
+++ b/src/utils/Utils.hpp
@@ -60,3 +60,6 @@ boost::optional readAs(const std::string& str)
return res;
}
+std::string
+replaceInString(std::string str, const std::string& from, const std::string& to);
+