0

I'm using Django with django-two-factor-auth for my web application. I can now send SMS via Twilio and verify it, but I haven't figured out how to resend the SMS code when I need i.e. click on "Didn't received your code? Resend!".

I have read through django-two-factor-auth docs but couldn't find any info about implementing this.

Do I need to configure django-two-factor-auth somehow, or customize the lib (which is what I don't really prefer to do) ?

Could you please help me? Thank you for your time :)

Luan Nguyen
  • 803
  • 6
  • 14

1 Answers1

0

Currently this is not possible with this package. However feel free to request this issue on the GitHub repository.

Another possibility is to implement this yourself. The token is sent when the wizard page named token is rendered. Your template would need to submit a POST to the login view, requesting the same page. The button should look similar to the request backup token, so (untested) something like this:

    <button name="challenge_device" value="{{ device.persistent_id }}"
            class="btn btn-default btn-block" type="submit">Resend token</button>
Bouke
  • 10,025
  • 6
  • 49
  • 88
  • Thanks @bouke. I'm using that work-around method :grinning:. Things work well, but it will be nice if you can add that – Luan Nguyen May 28 '15 at 08:31