From 53d06f127d4c1b5c1b4ca5b972f38262b95a59d8 Mon Sep 17 00:00:00 2001 From: f4lkensmaz3 <96619492+f4lkensmaz3@users.noreply.github.com> Date: Sat, 6 Jan 2024 21:54:30 +0000 Subject: [PATCH] Prevent duplicate characters in "Also choose from" field of password generator (#9803) * Fixes #9797 --- src/core/PasswordGenerator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/PasswordGenerator.cpp b/src/core/PasswordGenerator.cpp index 01641bc802..aa0f3e7172 100644 --- a/src/core/PasswordGenerator.cpp +++ b/src/core/PasswordGenerator.cpp @@ -261,8 +261,10 @@ QVector PasswordGenerator::passwordGroups() const if (!m_custom.isEmpty()) { PasswordGroup group; - for (auto ch : m_custom) { - group.append(ch); + for (const auto& ch : m_custom) { + if (!group.contains(ch)) { + group.append(ch); + } } passwordGroups.append(group);