MCPcopy Index your code
hub / github.com/ddserver/ddserver / wrapped

Function wrapped

ddserver/interface/captcha.py:54–80  ·  view source on GitHub ↗
(config,
                users,
                messages,
                *args,
                **kwargs)

Source from the content-addressed store, hash-verified

52 users = 'ddserver.interface.user:UserManager',
53 messages = 'ddserver.interface.message:MessageManager')
54 def wrapped(config,
55 users,
56 messages,
57 *args,
58 **kwargs):
59 if config.captcha.enabled:
60 from recaptcha.client import captcha
61
62 challenge = bottle.request.POST.pop('recaptcha_challenge_field', None)
63 response = bottle.request.POST.pop('recaptcha_response_field', None)
64
65 if challenge is None or response is None:
66 messages.error('Captcha values are missing')
67 bottle.redirect('/')
68
69 result = captcha.submit(challenge,
70 response,
71 config.captcha.recaptcha_private_key,
72 bottle.request.remote_addr)
73
74 if not result.is_valid:
75 messages.error('Captcha invalid')
76 bottle.redirect(__on_error__)
77
78 # Call the wrapped function
79 return func(*args,
80 **kwargs)
81
82 return wrapped
83 return wrapper

Callers

nothing calls this directly

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected