Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keygendialog email and name validition (issue 202) #203

Merged
merged 1 commit into from
Oct 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions keygendialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ void KeygenDialog::no_protection(bool enable) {
*/
void KeygenDialog::done(int r) {
if (QDialog::Accepted == r) { // ok was pressed
// check name
if (ui->name->text().length() < 5) {
QMessageBox::critical(this, tr("Invalid name"), tr("Name must be at least 5 characters long."));
return;
}

// check email
QRegExp mailre("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b");
mailre.setCaseSensitivity(Qt::CaseInsensitive);
mailre.setPatternSyntax(QRegExp::RegExp);
if (!mailre.exactMatch(ui->email->text())) {
QMessageBox::critical(this, tr("Invalid email"), tr("The email address you typed is not a valid email address."));
return;
}

ui->widget->setEnabled(false);
ui->buttonBox->setEnabled(false);
ui->checkBox->setEnabled(false);
Expand Down
15 changes: 13 additions & 2 deletions localization/localization_ar_MA.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ar_MA">
<TS version="2.0" language="ar_MA">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>ConfigDialog</name>
<message>
Expand Down Expand Up @@ -398,7 +399,17 @@ Expire-Date: 0
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="142"/>
<location filename="../keygendialog.cpp" line="133"/>
<source>Invalid name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="133"/>
<source>The name should be longer than 4 characters.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="148"/>
<source>This operation can take some minutes.&lt;br /&gt;We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.</source>
<translation type="unfinished"></translation>
</message>
Expand Down
15 changes: 13 additions & 2 deletions localization/localization_cs_CZ.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="cs_CZ">
<TS version="2.0" language="cs_CZ">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>ConfigDialog</name>
<message>
Expand Down Expand Up @@ -414,7 +415,17 @@ Expire-Date: 0
<translation>Možnosti expertního nastavení můžete nalézt v &lt;a href=&quot;https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html&quot;&gt;GnuPG manuálu&lt;/a&gt;</translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="142"/>
<location filename="../keygendialog.cpp" line="133"/>
<source>Invalid name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="133"/>
<source>The name should be longer than 4 characters.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="148"/>
<source>This operation can take some minutes.&lt;br /&gt;We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.</source>
<translation>Tato operace může zabrat několik minut.&lt;br /&gt;Je třeba vygenerovat množství náhodných dat. Pro urychlení můžete pomoci (psaním na klávesnici, pohybováním myší, zapisováním na disk) s jejich generováním; toto pomůže generátoru náhodných čísel zvýšit šanci na získání dostatečné entropie.</translation>
</message>
Expand Down
33 changes: 22 additions & 11 deletions localization/localization_de_DE.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<TS version="2.0" language="de_DE">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>ConfigDialog</name>
<message>
Expand Down Expand Up @@ -43,7 +44,7 @@
</message>
<message>
<source>&amp;Native git/gpg</source>
<translation type="vanished">&amp;git/pgp verwenden</translation>
<translation type="obsolete">&amp;git/pgp verwenden</translation>
</message>
<message>
<location filename="../configdialog.ui" line="484"/>
Expand Down Expand Up @@ -210,7 +211,7 @@ email</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://www.passwordstore.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;www.passwordstore.org&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="vanished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://www.passwordstore.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;www.passwordstore.org&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
<translation type="obsolete">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://www.passwordstore.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;www.passwordstore.org&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../configdialog.ui" line="36"/>
Expand Down Expand Up @@ -346,7 +347,7 @@ e-mail</translation>
</message>
<message>
<source>&lt;a href=&quot;http://QtPass.org/&quot;&gt;QtPass&lt;/a&gt; version </source>
<translation type="vanished">&lt;a href=&quot;http://QtPass.org/&quot;&gt;QtPass&lt;/a&gt; Version </translation>
<translation type="obsolete">&lt;a href=&quot;http://QtPass.org/&quot;&gt;QtPass&lt;/a&gt; Version </translation>
</message>
<message>
<location filename="../configdialog.ui" line="691"/>
Expand Down Expand Up @@ -476,7 +477,17 @@ Expire-Date: 0
<translation>Einstellungen für Fortgeschrittene zu finden unter &lt;a href=&quot;https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html&quot;&gt;GnuPG manual&lt;/a&gt;</translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="142"/>
<location filename="../keygendialog.cpp" line="133"/>
<source>Invalid name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="133"/>
<source>The name should be longer than 4 characters.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../keygendialog.cpp" line="148"/>
<source>This operation can take some minutes.&lt;br /&gt;We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.</source>
<translatorcomment>Google translate FTW</translatorcomment>
<translation>Dieser Vorgang kann einige Minuten dauern.&lt;br /&gt;Wir brauchen eine Menge von zufälligen Bytes zu erzeugen. Es ist eine gute Idee, eine andere Aktion (Typ auf der Tastatur, bewegen Sie die Maus verwenden, um die Scheiben) während der Prime-Generation zu erfüllen; Dies gibt dem Zufallszahlengenerator eine bessere Chance, genug Entropie zu gewinnen.</translation>
Expand Down Expand Up @@ -591,7 +602,7 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; color:#333333;&quot;&gt;&lt;br /&gt;Please report any &lt;/span&gt;&lt;a href=&quot;https://github.com/IJHack/qtpass/issues&quot;&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; text-decoration: underline; color:#4183c4;&quot;&gt;issues&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; color:#333333;&quot;&gt; you might have with this software.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://qtpass.org/&quot;&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; text-decoration: underline; color:#4183c4; background-color:transparent;&quot;&gt;Documentation&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/IJHack/qtpass&quot;&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; text-decoration: underline; color:#4183c4; background-color:transparent;&quot;&gt;Source code&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="vanished">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
<translation type="obsolete">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;.Helvetica Neue DeskInterface&apos;; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
Expand All @@ -602,7 +613,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>X</source>
<translation type="vanished">X</translation>
<translation type="obsolete">X</translation>
</message>
<message>
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
Expand All @@ -613,7 +624,7 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; color:#333333;&quot;&gt;&lt;br /&gt;Please report any &lt;/span&gt;&lt;a href=&quot;https://github.com/IJHack/qtpass/issues&quot;&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; text-decoration: underline; color:#4183c4;&quot;&gt;issues&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; color:#333333;&quot;&gt; you might have with this software.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://qtpass.org/&quot;&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; text-decoration: underline; color:#4183c4; background-color:transparent;&quot;&gt;Documentation&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/IJHack/qtpass&quot;&gt;&lt;span style=&quot; font-family:&apos;Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif&apos;; font-size:13pt; text-decoration: underline; color:#4183c4; background-color:transparent;&quot;&gt;Source code&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="vanished">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
<translation type="obsolete">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;.Helvetica Neue DeskInterface&apos;; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
Expand Down Expand Up @@ -782,7 +793,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>New password file, will be placed in folder %1:</source>
<translation type="vanished">Neue Passwortdatei wird gespeichert im Ordner %1:</translation>
<translation type="obsolete">Neue Passwortdatei wird gespeichert im Ordner %1:</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1771"/>
Expand All @@ -796,7 +807,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>New folder, will be placed in folder %1:</source>
<translation type="vanished">Neuer Ordner wird in Verzeichnis %1 erstellt:</translation>
<translation type="obsolete">Neuer Ordner wird in Verzeichnis %1 erstellt:</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1899"/>
Expand Down Expand Up @@ -1011,7 +1022,7 @@ Die roten Einträge sind ungültig / abgelaufen und für Entschlüsselung nicht
</message>
<message>
<source>X</source>
<translation type="vanished">X</translation>
<translation type="obsolete">X</translation>
</message>
<message>
<location filename="../usersdialog.ui" line="72"/>
Expand Down
Loading