Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(20)  |  Call(12)  |  Derive(0)  |  Import(8)

src/d/j/django-two-factor-auth-HEAD/two_factor/views/profile.py   django-two-factor-auth(Download)
from django.views.decorators.cache import never_cache
from django.views.generic import TemplateView, FormView
from django_otp import user_has_device, devices_for_user
 
from ..forms import DisableForm
    def form_valid(self, form):
        for device in devices_for_user(self.request.user):
            device.delete()
        return redirect(self.redirect_url or str(settings.LOGIN_REDIRECT_URL))
 

src/d/j/django-two-factor-auth-0.5.0/two_factor/views/profile.py   django-two-factor-auth(Download)
from django.views.decorators.cache import never_cache
from django.views.generic import TemplateView, FormView
from django_otp import user_has_device, devices_for_user
 
from ..forms import DisableForm
    def form_valid(self, form):
        for device in devices_for_user(self.request.user):
            device.delete()
        return redirect(self.redirect_url or str(settings.LOGIN_REDIRECT_URL))
 

src/d/j/django-two-factor-auth-HEAD/two_factor/utils.py   django-two-factor-auth(Download)
from two_factor.models import PhoneDevice
 
from django_otp import devices_for_user
 
try:
def default_device(user):
    if not user or user.is_anonymous():
        return
    for device in devices_for_user(user):
        if device.name == 'default':

src/d/j/django-two-factor-auth-HEAD/two_factor/management/commands/disable.py   django-two-factor-auth(Download)
    User = get_user_model()
 
from django_otp import devices_for_user
 
 
                raise CommandError('User "%s" does not exist' % username)
 
            for device in devices_for_user(user):
                device.delete()
 

src/d/j/django-two-factor-auth-0.5.0/two_factor/utils.py   django-two-factor-auth(Download)
from two_factor.models import PhoneDevice
 
from django_otp import devices_for_user
 
 
def default_device(user):
    if not user or user.is_anonymous():
        return
    for device in devices_for_user(user):

src/r/a/RatticWeb-HEAD/staff/views.py   RatticWeb(Download)
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.translation import ugettext as _
from django_otp import user_has_device, devices_for_user
from django.core.files.uploadedfile import SimpleUploadedFile
 
 
    # Delete all devices (backup, token and phone)
    for dev in devices_for_user(user):
        dev.delete()
 

src/r/a/RatticWeb-HEAD/account/management/commands/demosetup.py   RatticWeb(Download)
from django.core.management.base import BaseCommand
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.models import User
from django_otp import devices_for_user
 
 
        # Delete any tokens they may have
        for dev in devices_for_user(u):
            dev.delete()
 

src/d/j/django-two-factor-auth-HEAD/tests/tests.py   django-two-factor-auth(Download)
    User = get_user_model()
 
from django_otp import DEVICE_ID_SESSION_KEY, devices_for_user
from django_otp.oath import totp
from django_otp.util import random_hex
                                    {'understand': '1'})
        self.assertRedirects(response, str(settings.LOGIN_REDIRECT_URL))
        self.assertEqual(list(devices_for_user(self.user)), [])
 
        # cannot disable twice
    def test_disable_single(self):
        user = self.create_user()
        self.enable_otp(user)
        call_command('disable', 'bouke@example.com')
        self.assertEqual(list(devices_for_user(user)), [])
        [self.enable_otp(user) for user in users]
        call_command('disable', *usernames[:2])
        self.assertEqual(list(devices_for_user(users[0])), [])
        self.assertEqual(list(devices_for_user(users[1])), [])
        self.assertNotEqual(list(devices_for_user(users[2])), [])