Skip to content

Commit

Permalink
Added security for name payments! Names with leading or trailing spaces
Browse files Browse the repository at this point in the history
are forbidding for name payments, names that can be bought through
exchange are also forbidden!
  • Loading branch information
Skerberus committed Mar 26, 2015
1 parent cab5b47 commit c7a01a8
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions Qora/src/gui/SendMoneyPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
{

Expand Down

0 comments on commit c7a01a8

Please sign in to comment.