Beispiel #1
0
from django.utils.unittest import skipIf
from gargoyle.models import SELECTIVE, Switch
from mock import patch, MagicMock
from oauthlib import oauth1
from openid.message import IDENTIFIER_SELECT
from pyquery import PyQuery

from identityprovider import signed
from identityprovider.models.authtoken import create_token
from identityprovider.tests import DEFAULT_USER_PASSWORD
from identityprovider.tests.factory import SSOObjectFactory
from identityprovider.views import server


# call autodiscover to ensure that the custom condition sets are registered
gargoyle.autodiscover()


MISSING_BACKUP_DEVICE = """
<div class="message warning" id="missing_backup_device">
  <p>
    We strongly recommend having two authentication devices,
    a <strong>primary</strong> device and a <strong>secondary</strong>
    or backup device.
    </br>
    Having two authentication devices means you can continue to access your
    account with your secondary device should your primary device be lost or
    stolen.
    </br>
    </br>
    Click to <a href="{add_device_link}">add a backup device</a>.
Beispiel #2
0
import os.path

from functools import wraps

from django.conf import settings
from django.http import HttpResponse, HttpResponseNotFound

from gargoyle import gargoyle, autodiscover
from gargoyle.helpers import dumps
from gargoyle.models import Switch, DISABLED
from gargoyle.conditions import ValidationError
from gargoyle import signals

GARGOYLE_ROOT = os.path.dirname(__file__)

autodiscover()

logger = logging.getLogger('gargoyle.switches')


class GargoyleException(Exception):
    def __init__(self, message):
        self.message = message

    def __str__(self):
        return self.message


def json(func):
    "Decorator to make JSON views simpler"
Beispiel #3
0
from functools import wraps

from django.conf import settings
from django.http import HttpResponse
from django.utils import simplejson

from gargoyle import gargoyle, autodiscover
from gargoyle.models import Switch, DISABLED
from gargoyle.conditions import ValidationError
from gargoyle import signals


GARGOYLE_ROOT = os.path.dirname(__file__)

autodiscover()


class GargoyleException(Exception):
    def __init__(self, message):
        self.message = message

    def __str__(self):
        return self.message


def json(func):
    "Decorator to make JSON views simpler"

    def wrapper(self, request, *args, **kwargs):
        try:
Beispiel #4
0
from contacts.views.log_views import email_log_view

from invitations.views import (
    CreateInviteView,
    AcceptInviteView,
)

from logtacts.views import HomeView
from payments.views import (
    PaymentView,
    stripe_webhook_view,
)
from chats.views import sms

admin.autodiscover()
gargoyle.autodiscover()

foursquare_urls = [
    url('^login/$', foursquare_views.oauth2_login, name="foursquare_login"),
    url(
        '^login/callback/$',
        foursquare_views.oauth2_callback,
        name="foursquare_callback",
    ),
]

twitter_urls = [
    url('^login/$', twitter_views.oauth_login, name="twitter_login"),
    url(
        '^login/callback/$',
        twitter_views.oauth_callback,