From c7a01a83f5c3eb8c3e1a53728416112ab9b3d979 Mon Sep 17 00:00:00 2001 From: Skerberus Date: Thu, 26 Mar 2015 18:33:10 +0100 Subject: [PATCH] Added security for name payments! Names with leading or trailing spaces are forbidding for name payments, names that can be bought through exchange are also forbidden! --- Qora/src/gui/SendMoneyPanel.java | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Qora/src/gui/SendMoneyPanel.java b/Qora/src/gui/SendMoneyPanel.java index ea5d650d..2f8a524f 100644 --- a/Qora/src/gui/SendMoneyPanel.java +++ b/Qora/src/gui/SendMoneyPanel.java @@ -257,14 +257,38 @@ public void onSendClick() return; - }else - { + } + + //NAME STARTS OR ENDS WITH SPACE? + if(recipientAddress.startsWith(" ") || recipientAddress.endsWith(" ")) + { + + JOptionPane.showMessageDialog(null, "For security purposes sending payments to a name that starts or ends with spaces is forbidden." , "Error", JOptionPane.ERROR_MESSAGE); + + //ENABLE + this.sendButton.setEnabled(true); + + return; + } + + //NAME FOR SALE? + if( DBSet.getInstance().getNameExchangeMap().contains(recipientAddress)) + { + JOptionPane.showMessageDialog(null, "For security purposes sending payments to a name that can be purchased through name exchange is disabled." , "Error", JOptionPane.ERROR_MESSAGE); + + //ENABLE + this.sendButton.setEnabled(true); + + return; + } + + //LOOKUP ADDRESS FOR NAME Name name = names.get(recipientAddress); recipientAddress = name.getOwner().getAddress(); recipient = new Account(recipientAddress); - } + }else {