From b083cc8775d27eb0fde52bea3beeb46297ad62e4 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 1 Aug 2021 13:23:42 +0200 Subject: app/wallet: forbid money transfers to oneself --- app/app_wallet.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') 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( if recipient_user is None: raise LookupError('Could not find recipient') + if recipient_user.id == session.get_user_id(): + raise LookupError('Cannot transfer money to oneself.') + tx.transfer( from_user_id=session.get_user_id(), to_user_id=recipient_user.id, -- cgit v1.2.3