gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-bank] branch master updated: add 'minus' in captcha


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] branch master updated: add 'minus' in captcha
Date: Sat, 09 Dec 2017 00:24:40 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository bank.

The following commit(s) were added to refs/heads/master by this push:
     new 3edebc5  add 'minus' in captcha
3edebc5 is described below

commit 3edebc5ec36da2fbfcbf65ede53ddecdc4cc211e
Author: Florian Dold <address@hidden>
AuthorDate: Sat Dec 9 00:24:35 2017 +0100

    add 'minus' in captcha
---
 talerbank/app/views.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index da019d4..39d35cf 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -169,10 +169,14 @@ def hash_answer(ans):
 
 def make_question():
     num1 = random.randint(1, 10)
-    op = random.choice(("*", "+"))
+    op = random.choice(("*", "+", "-"))
     num2 = random.randint(1, 10)
     if op == "*":
         answer = str(num1 * num2)
+    elif op == "-":
+        # ensure result is positive
+        num1, num2 = max(num1, num2), min(num1, num2)
+        answer = str(num1 - num2)
     else:
         answer = str(num1 + num2)
     question = "{} {} {}".format(num1, op, num2)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]