From 485df3889ddcb18b47799557fefc3e9a67055152 Mon Sep 17 00:00:00 2001 From: romanetar Date: Sun, 12 Oct 2025 10:56:18 +0200 Subject: [PATCH] fix: show special characters properly in validation messages Signed-off-by: romanetar --- resources/js/utils.js | 8 +++++++- resources/js/validator.js | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/js/utils.js b/resources/js/utils.js index 3a45f2e9..7b35a202 100644 --- a/resources/js/utils.js +++ b/resources/js/utils.js @@ -80,4 +80,10 @@ export const formatTime = (timeInSeconds) => { res = res.slice(0, -2); } return res; -} \ No newline at end of file +} + +export const decodeHtmlEntities = (text) => { + const textarea = document.createElement('textarea'); + textarea.innerHTML = text; + return textarea.value; +}; \ No newline at end of file diff --git a/resources/js/validator.js b/resources/js/validator.js index afae1824..245fd4a8 100644 --- a/resources/js/validator.js +++ b/resources/js/validator.js @@ -1,4 +1,5 @@ import {ref, string} from "yup"; +import {decodeHtmlEntities} from "./utils.js" const validatePasswordPattern = (shapePattern, allowed_special_characters, warning) => { return function(value) { @@ -25,7 +26,7 @@ const validatePasswordPattern = (shapePattern, allowed_special_characters, warni // Check remain requirements return this.createError({ - message: warning, + message: decodeHtmlEntities(warning), path: this.path, }); }