Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
7642f639
Commit
7642f639
authored
10 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
check password for non printable chars
fix bug on request if transfert amount is 0
parent
57e00bcf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cutecoin/gui/password_asker.py
+24
-7
24 additions, 7 deletions
src/cutecoin/gui/password_asker.py
src/cutecoin/gui/transfer.py
+6
-0
6 additions, 0 deletions
src/cutecoin/gui/transfer.py
with
30 additions
and
7 deletions
src/cutecoin/gui/password_asker.py
+
24
−
7
View file @
7642f639
...
...
@@ -5,6 +5,8 @@ Created on 24 dec. 2014
'''
import
logging
import
unicodedata
import
re
from
PyQt5.QtWidgets
import
QDialog
,
QMessageBox
...
...
@@ -40,16 +42,24 @@ class PasswordAskerDialog(QDialog, Ui_PasswordAskerDialog):
def
accept
(
self
):
password
=
self
.
edit_password
.
text
()
if
self
.
account
.
check_password
(
password
):
self
.
remember
=
self
.
check_remember
.
isChecked
()
self
.
password
=
password
self
.
edit_password
.
setText
(
""
)
logging
.
debug
(
"
Password is valid
"
)
super
().
accept
()
else
:
if
detect_non_printable
(
password
):
QMessageBox
.
warning
(
self
,
"
Bad password
"
,
"
Non printable characters in password
"
,
QMessageBox
.
Ok
)
return
False
if
not
self
.
account
.
check_password
(
password
):
QMessageBox
.
warning
(
self
,
"
Failed to get private key
"
,
"
Wrong password typed. Cannot open the private key
"
,
QMessageBox
.
Ok
)
return
False
self
.
remember
=
self
.
check_remember
.
isChecked
()
self
.
password
=
password
self
.
edit_password
.
setText
(
""
)
logging
.
debug
(
"
Password is valid
"
)
super
().
accept
()
def
reject
(
self
):
self
.
edit_password
.
setText
(
""
)
...
...
@@ -57,3 +67,10 @@ class PasswordAskerDialog(QDialog, Ui_PasswordAskerDialog):
self
.
setResult
(
QDialog
.
Accepted
)
self
.
password
=
""
super
().
reject
()
def
detect_non_printable
(
data
):
control_chars
=
''
.
join
(
map
(
chr
,
list
(
range
(
0
,
32
))
+
list
(
range
(
127
,
160
))))
control_char_re
=
re
.
compile
(
'
[%s]
'
%
re
.
escape
(
control_chars
))
if
control_char_re
.
search
(
data
):
return
True
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/transfer.py
+
6
−
0
View file @
7642f639
...
...
@@ -55,6 +55,12 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog):
recipient
=
self
.
edit_pubkey
.
text
()
amount
=
self
.
spinbox_amount
.
value
()
if
not
amount
:
QMessageBox
.
critical
(
self
,
"
Money transfer
"
,
"
No amount. Please give the transfert amount
"
,
QMessageBox
.
Ok
)
return
password
=
self
.
password_asker
.
exec_
()
if
self
.
password_asker
.
result
()
==
QDialog
.
Rejected
:
return
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment