From 4f4f53cbdc08a637da72ed0527d13e3bde8047f7 Mon Sep 17 00:00:00 2001 From: richardtekula Date: Fri, 5 Dec 2025 11:27:06 +0100 Subject: [PATCH] Fix: Remove problematic characters from temp password generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove special characters (!@#$%^&*) that cause login issues - Remove ambiguous characters (I, O, l, i, o, 0, 1) for better readability - Keep only alphanumeric characters for safe copy-paste and input 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/utils/password.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils/password.js b/src/utils/password.js index f89678e..3c7b196 100644 --- a/src/utils/password.js +++ b/src/utils/password.js @@ -23,15 +23,15 @@ export const comparePassword = async (password, hash) => { /** * Generuje náhodné dočasné heslo + * Používa len bezpečné znaky (bez problematických ako #, $, %, &, atď.) * @param {number} length - Dĺžka hesla (default: 12) * @returns {string} Náhodné heslo */ export const generateTempPassword = (length = 12) => { - const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - const lowercase = 'abcdefghijklmnopqrstuvwxyz'; - const numbers = '0123456789'; - const special = '!@#$%^&*'; - const all = uppercase + lowercase + numbers + special; + const uppercase = 'ABCDEFGHJKLMNPQRSTUVWXYZ'; // bez I, O (ľahko zameniteľné) + const lowercase = 'abcdefghjkmnpqrstuvwxyz'; // bez i, l, o (ľahko zameniteľné) + const numbers = '23456789'; // bez 0, 1 (ľahko zameniteľné) + const all = uppercase + lowercase + numbers; let password = ''; @@ -39,7 +39,6 @@ export const generateTempPassword = (length = 12) => { password += uppercase[Math.floor(Math.random() * uppercase.length)]; password += lowercase[Math.floor(Math.random() * lowercase.length)]; password += numbers[Math.floor(Math.random() * numbers.length)]; - password += special[Math.floor(Math.random() * special.length)]; // Zvyšok náhodne for (let i = password.length; i < length; i++) {