Add message if send_sms fail with an Exception#316
Add message if send_sms fail with an Exception#316yoandyshyno wants to merge 5 commits intojazzband:masterfrom
Conversation
moggers87
left a comment
There was a problem hiding this comment.
This is very twilio specific and I doubt this bug only affects this backend. See my comment: #315 (comment)
Also, tests!
…age is added to the messages instance with this text.
Codecov Report
@@ Coverage Diff @@
## master #316 +/- ##
=========================================
Coverage ? 96.61%
=========================================
Files ? 39
Lines ? 1713
Branches ? 118
=========================================
Hits ? 1655
Misses ? 36
Partials ? 22Continue to review full report at Codecov.
|
Add correction in text.
The tests are in place, do you need something else at the moment? |
|
@yoandyshyno I did say that these changes are Twilio specific and I don't think the bug you found only affects Twilio. Have you looked into that? |
|
@moggers87 , I am sorry, I don't understand what else can be affecting the Bug, right now there is only one gateway that is able to send sms (Twilio). |
|
Your issue was with an uncaught exception causing an internal error response. Our view code should be catching errors from whatever backend you're using and as it's not I would assume this bug isn't specific to Twilio. This is why I asked for a stacktrace in #315 |
Here is the Stacktrace: File "/src/app/venv/CP/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner File "/src/app/venv/CP/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response File "/src/app/venv/CP/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response File "/src/app/venv/CP/lib/python3.7/site-packages/django/views/generic/base.py" in view File "/src/app/venv/CP/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapper File "/src/app/venv/CP/lib/python3.7/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper File "/src/app/venv/CP/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapper File "/src/app/venv/CP/lib/python3.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func File "/src/app/venv/CP/lib/python3.7/site-packages/formtools/wizard/views.py" in dispatch File "/src/app/venv/CP/lib/python3.7/site-packages/django/views/generic/base.py" in dispatch File "/src/app/venv/CP/lib/python3.7/site-packages/two_factor/views/core.py" in post File "/src/app/venv/CP/lib/python3.7/site-packages/two_factor/views/utils.py" in post File "/src/app/venv/CP/lib/python3.7/site-packages/formtools/wizard/views.py" in post File "/src/app/venv/CP/lib/python3.7/site-packages/formtools/wizard/views.py" in render_next_step File "/src/app/venv/CP/lib/python3.7/site-packages/two_factor/views/core.py" in render File "/src/app/venv/CP/lib/python3.7/site-packages/two_factor/models.py" in generate_challenge File "/src/app/venv/CP/lib/python3.7/site-packages/two_factor/gateways/init.py" in send_sms File "/src/app/venv/CP/lib/python3.7/site-packages/two_factor/gateways/twilio/gateway.py" in send_sms File "/src/app/venv/CP/lib/python3.7/site-packages/twilio/rest/api/v2010/account/message/init.py" in create File "/src/app/venv/CP/lib/python3.7/site-packages/twilio/base/version.py" in create Exception Type: TwilioRestException at /account/login/ |
|
I noticed in core.py , generate_challenge() is missing a try - except in some places. |
|
is this issue stalled? |
Description
In function send_sms of Twilio gateway we handled the call to client.messages.create()
Motivation and Context
In the Twilio gateway when calling function send_sms an exception might be raised, in this case an internal error is produced. For some cases we have an application which use two_factor and we want instead to show a message to the users. Fixes #315
How Has This Been Tested?
I tested the changes locally with a working Django application.
Types of changes
Checklist: