diff options
author | pacien | 2021-08-01 13:23:42 +0200 |
---|---|---|
committer | pacien | 2021-08-01 13:23:42 +0200 |
commit | b083cc8775d27eb0fde52bea3beeb46297ad62e4 (patch) | |
tree | 2e3a6342248c51d33c6ec875a8416fdd6ae9fb31 | |
parent | 2b0027333f646ad0a409d6676cecc5948d4444fd (diff) | |
download | uge_l2_rdbms_python_proto-b083cc8775d27eb0fde52bea3beeb46297ad62e4.tar.gz |
app/wallet: forbid money transfers to oneself
-rw-r--r-- | app/app_wallet.py | 3 |
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, |