Пример #1
0
def configure_social_auth_user(**kwargs):
    """Applies configuration used for external (non-Django) accounts.

    Adds user to settings.NEW_USER_INITIAL_GROUPS and sets isDjangoAccount
    to False in their UserProfile, so that MyTardis won't allow them to
    change their password.
    """
    user = kwargs.get('user')
    configure_user(user)
    return kwargs
Пример #2
0
    def authenticate(self, request):
        """ Authenticate a user, expecting the user will be using
        form-based auth and the *username* and *password* will be
        passed in url-encoded form **POST** variables.

        :param request: a HTTP Request instance
        :type request: :class:`django.http.HttpRequest`
        """
        username = request.POST['username']
        password = request.POST['password']
        if self._openEndpointWithCredentials(username, password) == None:
            return None
        try:
            user = User.objects.get(username=username)
        except User.DoesNotExist:
            user = User.objects.create_user(username, '')
            user.save()
            configure_user(user)

        # We don't want a localdb user created, so don't use a dict
        return user
Пример #3
0
    def authenticate(self, request):
        """ Authenticate a user, expecting the user will be using
        form-based auth and the *username* and *password* will be
        passed in url-encoded form **POST** variables.

        :param request: a HTTP Request instance
        :type request: :class:`django.http.HttpRequest`
        """
        username = request.POST['username']
        password = request.POST['password']
        if self._openEndpointWithCredentials(username, password) == None:
            return None
        try:
            user = User.objects.get(username=username)
        except User.DoesNotExist:
            user = User.objects.create_user(username, '')
            user.save()
            configure_user(user);
            
        # We don't want a localdb user created, so don't use a dict
        return user