Mask passwords in URL column in Entry View

This commit is contained in:
Jonathan White 2017-09-29 14:10:54 -04:00 committed by Jonathan White
parent cb0b948603
commit 59786d7bd7
3 changed files with 11 additions and 2 deletions

View File

@ -727,6 +727,13 @@ const Database* Entry::database() const
}
}
QString Entry::maskPasswordPlaceholders(const QString &str) const
{
QString result = str;
result.replace(QRegExp("(\\{PASSWORD\\})", Qt::CaseInsensitive, QRegExp::RegExp2), "******");
return result;
}
QString Entry::resolveMultiplePlaceholders(const QString& str) const
{
QString result = str;

View File

@ -142,6 +142,7 @@ public:
*/
Entry* clone(CloneFlags flags) const;
void copyDataFrom(const Entry* other);
QString maskPasswordPlaceholders(const QString& str) const;
QString resolveMultiplePlaceholders(const QString& str) const;
QString resolvePlaceholder(const QString& str) const;
QString resolveUrl(const QString& url) const;

View File

@ -151,7 +151,8 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
}
return result;
case Url:
result = entry->resolveMultiplePlaceholders(entry->url());
result = entry->maskPasswordPlaceholders(entry->url());
result = entry->resolveMultiplePlaceholders(result);
if (attr->isReference(EntryAttributes::URLKey)) {
result.prepend(tr("Ref: ","Reference abbreviation"));
}