mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-15 17:27:43 -05:00
check autotype syntax, high repetion, reformat code
TODO: specify what should happen when autotypesyntax incorrect
This commit is contained in:
parent
45cb97ec85
commit
4fcedc2187
@ -394,7 +394,8 @@ QList<AutoTypeAction*> AutoType::createActionFromTemplate(const QString& tmpl, c
|
||||
else if (tmplName.compare("delay",Qt::CaseInsensitive)==0) {
|
||||
if (num > 10000) {
|
||||
QMessageBox::StandardButton reply;
|
||||
reply = QMessageBox::question(0,"AutoType",
|
||||
reply = QMessageBox::question(0,
|
||||
"AutoType",
|
||||
"This AutoType command contains a very long delay. Do you really want to execute it?");
|
||||
|
||||
if (reply == QMessageBox::No) {
|
||||
@ -404,7 +405,8 @@ QList<AutoTypeAction*> AutoType::createActionFromTemplate(const QString& tmpl, c
|
||||
}
|
||||
else if (num > 100) {
|
||||
QMessageBox::StandardButton reply;
|
||||
reply = QMessageBox::question(0,"AutoType",
|
||||
reply = QMessageBox::question(0,
|
||||
"AutoType",
|
||||
"This AutoType command contains arguments which are repeated very often. Do you really want to execute it?");
|
||||
|
||||
if (reply == QMessageBox::No) {
|
||||
@ -644,7 +646,8 @@ QString AutoType::autoTypeSequence(const Entry* entry, const QString& windowTitl
|
||||
group = group->parentGroup();
|
||||
} while (group && (!enableSet || sequence.isEmpty()));
|
||||
|
||||
if (sequence.isEmpty() && (!entry->resolvePlaceholder(entry->username()).isEmpty() || !entry->resolvePlaceholder(entry->password()).isEmpty())) {
|
||||
if (sequence.isEmpty() && (!entry->resolvePlaceholder(entry->username()).isEmpty()
|
||||
|| !entry->resolvePlaceholder(entry->password()).isEmpty())) {
|
||||
if (entry->resolvePlaceholder(entry->username()).isEmpty()) {
|
||||
sequence = "{PASSWORD}{ENTER}";
|
||||
}
|
||||
|
@ -764,6 +764,20 @@ void EditEntryWidget::updateEntryData(Entry* entry) const
|
||||
entry->setDefaultAutoTypeSequence(QString());
|
||||
}
|
||||
else {
|
||||
QRegExp autoTypeSyntax("(\\{[A-Z]*(\\s[0-9]*){0,1}\\})*");
|
||||
autoTypeSyntax.setCaseSensitivity(Qt::CaseInsensitive);
|
||||
autoTypeSyntax.setPatternSyntax(QRegExp::RegExp);
|
||||
|
||||
|
||||
QRegExp highRepetition(".*[0-9]{3,}.*"); //the 3 means 3 digitnumbers are too much
|
||||
highRepetition.setPatternSyntax(QRegExp::RegExp);
|
||||
|
||||
if (!autoTypeSyntax.exactMatch(m_autoTypeUi->sequenceEdit->text())) {
|
||||
//@TODO handle wrong syntax
|
||||
}
|
||||
if (!highRepetition.exactMatch(m_autoTypeUi->sequenceEdit->text())) {
|
||||
//@TODO handle too much repetition
|
||||
}
|
||||
entry->setDefaultAutoTypeSequence(m_autoTypeUi->sequenceEdit->text());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user