aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2021-08-01 13:23:42 +0200
committerpacien2021-08-01 13:23:42 +0200
commitb083cc8775d27eb0fde52bea3beeb46297ad62e4 (patch)
tree2e3a6342248c51d33c6ec875a8416fdd6ae9fb31
parent2b0027333f646ad0a409d6676cecc5948d4444fd (diff)
downloaduge_l2_rdbms_python_proto-b083cc8775d27eb0fde52bea3beeb46297ad62e4.tar.gz
app/wallet: forbid money transfers to oneself
-rw-r--r--app/app_wallet.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/app_wallet.py b/app/app_wallet.py
index 922c683..9154dcc 100644
--- a/app/app_wallet.py
+++ b/app/app_wallet.py
@@ -51,6 +51,9 @@ def wallet_transfer(
51 if recipient_user is None: 51 if recipient_user is None:
52 raise LookupError('Could not find recipient') 52 raise LookupError('Could not find recipient')
53 53
54 if recipient_user.id == session.get_user_id():
55 raise LookupError('Cannot transfer money to oneself.')
56
54 tx.transfer( 57 tx.transfer(
55 from_user_id=session.get_user_id(), 58 from_user_id=session.get_user_id(),
56 to_user_id=recipient_user.id, 59 to_user_id=recipient_user.id,