jazzband / django-two-factor-auth

Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.
MIT License
1.71k stars 448 forks source link

Add plivo gateway. #672

Open wieczorek1990 opened 1 year ago

wieczorek1990 commented 1 year ago

Added Plivo gateway for SMS.

Description

I added a new module in gateways for sending SMS using the phone number module.

Motivation and Context

Plivo is an alternative to Twilio.

How Has This Been Tested?

Manually tested with use of the setup page and read on the SMS debug page of Plivo.

Types of changes

Checklist:

wieczorek1990 commented 1 year ago

Will add different template.

W dniu wt., 17.10.2023 o 17:22 Claude Paroz @.***> napisał(a):

@.**** requested changes on this pull request.

Thanks for this code! This still needs documentation on how to configure this gateway.

Moreover, I think you cannot simply change the name of the sms template, as people having overridden the template will suddenly see the default template instead of the custom one. I would suggest adding a list of two templates in render_to_string, so the old path is still used if it exists in user projects.

— Reply to this email directly, view it on GitHub https://github.com/jazzband/django-two-factor-auth/pull/672#pullrequestreview-1682664954, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMRLK7GFJD33BTMGDWM4QTX72PDBAVCNFSM6AAAAAA6D7V33WVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTMOBSGY3DIOJVGQ . You are receiving this because you authored the thread.Message ID: @.***>

wieczorek1990 commented 1 year ago

@claudep I do not see a possibility to use two template_name's in render_to_string.

wieczorek1990 commented 1 year ago

@claudep Added documentation.

claudep commented 1 year ago

@claudep I do not see a possibility to use two template_name's in render_to_string.

From https://docs.djangoproject.com/en/4.2/topics/templates/#django.template.loader.render_to_string, The name of the template to load and render. If it’s a list of template names, Django uses select_template() instead of get_template() to find the template.

wieczorek1990 commented 1 year ago

I do not like this solution. The parameter check only said template_name.

W dniu wt., 17.10.2023 o 17:58 Claude Paroz @.***> napisał(a):

@claudep https://github.com/claudep I do not see a possibility to use two template_name's in render_to_string.

From https://docs.djangoproject.com/en/4.2/topics/templates/#django.template.loader.render_to_string, The name of the template to load and render. If it’s a list of template names, Django uses select_template() instead of get_template() to find the template.

— Reply to this email directly, view it on GitHub https://github.com/jazzband/django-two-factor-auth/pull/672#issuecomment-1766713544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMRLKY2ZWAT766XJHUBLS3X72TJHAVCNFSM6AAAAAA6D7V33WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRWG4YTGNJUGQ . You are receiving this because you authored the thread.Message ID: @.***>

wieczorek1990 commented 1 year ago

@claudep can we go with a separate template?

W dniu wt., 17.10.2023 o 19:13 Łukasz Wieczorek @.***> napisał(a):

I do not like this solution. The parameter check only said template_name.

W dniu wt., 17.10.2023 o 17:58 Claude Paroz @.***> napisał(a):

@claudep https://github.com/claudep I do not see a possibility to use two template_name's in render_to_string.

From https://docs.djangoproject.com/en/4.2/topics/templates/#django.template.loader.render_to_string, The name of the template to load and render. If it’s a list of template names, Django uses select_template() instead of get_template() to find the template.

— Reply to this email directly, view it on GitHub https://github.com/jazzband/django-two-factor-auth/pull/672#issuecomment-1766713544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMRLKY2ZWAT766XJHUBLS3X72TJHAVCNFSM6AAAAAA6D7V33WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRWG4YTGNJUGQ . You are receiving this because you authored the thread.Message ID: @.***>