def api_v1_logout(request):
    django_logout(request)
    message='looged out successfully'
    data={'message':message}
    #return HttpResponseRedirect('/api/v2/login/')
    data = simplejson.dumps(data)
    return HttpResponse(data, mimetype='application/json')
Example #2
0
File: ajax.py Project: albanm/djity
def logout(request,context=None):
    django_logout(request)
    dajax = Dajax()
    msg = _('You are now disconnected.')
    messages.add_message(request, messages.INFO, unicode(msg) )
    dajax.script('location.reload()')
    return dajax.json()
Example #3
0
def logout(request, redirect_url=settings.LOGOUT_REDIRECT_URL):
    """
        Nothing hilariously hidden here, logs a user out. Strip this out if your
        application already has hooks to handle this.
    """
    django_logout(request)
    return HttpResponseRedirect(request.build_absolute_uri(redirect_url))
Example #4
0
def logout_user(request):
    signals.on_before_logout.send(None, request=request)

    django_logout(request)
    request.session.flush()

    request.session[accounts_settings.SESSION_FIRST_TIME_VISIT_VISITED_KEY] = True
Example #5
0
def user_logout(request):
    """
        Logs the currently logged-in user out.
    """
    django_logout(request)
    request.session.flush()
    return HttpResponseRedirect(reverse('home:index', args=()))
Example #6
0
def session(request):
    """
    This function creates a user with
    no password set. This enables the user
    to stay anonymous but still save values
    in other softgis apps.

    GET request returns the session
    POST request creates a session for anonymous user
    DELETE request ends the session
    """
    if request.method == "GET":
        return HttpResponse(request.session.session_key)

    elif request.method == "POST":

        if request.user.is_authenticated():
            return HttpResponse(u"session already created")

        create_anonymous_user(request)

        return HttpResponse(u"session created")

    elif request.method == "DELETE":

        django_logout(request)

        return HttpResponse(u"session end")
Example #7
0
def logout_page(request):
    # check whether the true parameter exists
    user_logout_parameter = request.GET.get("logout")
    if user_logout_parameter:
        django_logout(request)  # logout the user! Destroying the session
        return HttpResponseRedirect("/")
    return HttpResponseRedirect("/")
Example #8
0
def logout(request):
    logger.debug(request)
    django_logout(request)
    if request.POST.get('cas', False):
        return cas_logoutRedirect()
    RequestContext(request)
    return HttpResponseRedirect(settings.REDIRECT_URL+'/login')
Example #9
0
File: views.py Project: fadiga/folo
def logout(request):
    """
        logout est la views qui permet de se deconnecter
    """

    django_logout(request)
    return redirect("/")
Example #10
0
 def form_valid(self, form):
     user = form.cleaned_data.get('user')
     UserSite.objects.filter(user=user).delete()
     user.is_active = False
     user.save()
     django_logout(self.request)
     return redirect('account_delete_complete')
Example #11
0
def logout(request):
    partner_pk = request.session[settings.PARTNER_SESSION_KEY] \
            if settings.PARTNER_SESSION_KEY in request.session \
            else None
    django_logout(request)
    if partner_pk:
        request.session[settings.PARTNER_SESSION_KEY] = partner_pk
Example #12
0
def delete_account(request):
    user = request.user
    user.is_active = False
    user.email = None
    user.save()
    django_logout(request)
    return redirect('/confirm')
Example #13
0
def logout(request):
    session_id = request.session.get('sessionid')
    if session_id:
        UOWSClient().logout(session_id)
    django_logout(request)
    request.session.flush()
    return redirect('index')
Example #14
0
    def logout(self, request = None):
        """ User requested logout.

        This cleans up browser-specific information, including
        - user object
        - SMS authentication codes
        - Authentication state
        - If request object was provided, Django user object.
        """
        if request:
            custom_log(request, "Logging out")
        else:
            log.info("Logging out: bid=%s" % self.bid)
        self.revoke_sms()
        if self.user:
            # Remove cached value
            r.delete("num_sessions-%s" % self.user.username)

        self.user = None
        self.save_browser = False
        self.auth_level = Browser.L_UNAUTH
        self.auth_state = Browser.S_REQUEST_BASIC
        self.auth_level_valid_until = None
        self.auth_state_valid_until = None
        self.authenticator_qr_nonce = None
        if request is not None:
            django_logout(request)
        self.save()
        self.auth_state_changed()
Example #15
0
def logout(request):
    django_logout(request)
    response = HttpResponseRedirect('/footprint/login')
    response.set_cookie(key=settings.SPROUTCORE_COOKIE_KEY, expires=datetime.utcnow())
    messages.add_message(request, messages.SUCCESS, "Successfully logged out.")

    return response
Example #16
0
def logout(request):
    """
    Log out view
    """
    django_logout(request)
    messages.success(request,'Has cerrado sesión')
    return redirect('/')
Example #17
0
def logout(request):
    """
    Log out view
    """
    django_logout(request)
    request.session["popup"] = 0
    return redirect('/accounts/login')
Example #18
0
def logout(request):
    redirect_url = request.META.get('HTTP_REFERER')
    if not redirect_url or reverse('login') in redirect_url:
        redirect_url = '/'
    django_logout(request)
    cache.clear()
    return redirect(redirect_url)
Example #19
0
def logout(request):
    """
    Log out from the page
    """
    from django.contrib.auth import logout as django_logout
    django_logout(request)
    return index(request)
Example #20
0
def logout(request):
    data = {}
    django_logout(request)

    messages.success(request, _(u"Benutzer ausgeloggt!"))

    return redirect(main)
Example #21
0
def login(request):
    if request.user.is_authenticated():
        return redirect('main.views.index')
    if request.POST:
        # load up the form with data from the POST request
        form = LoginForm(request.POST)
        if form.is_valid():
            user = authenticate(username=form.cleaned_data['email'],
                                password=form.cleaned_data['password'])
            if user is not None:
                django_login(request, user)
                fingr_user = user_to_fingr(request.user)
                notify_all_friends(fingr_user, 'Your friend ' + str(fingr_user.username) + ' has signed in')
                if user_to_fingr(user).verified:
                    notify_all_friends(fingr_user, 'Your friend ' + str(fingr_user.username) + ' has signed in')
                    # redirect to main page
                    return redirect('main.views.index')
                else:
                    django_logout(request)
                    #redirect to index page
                    return redirect('main.views.index')
    else:
        form = LoginForm()

    return render(request, 'login.html', {'form': form})
Example #22
0
def logout(request):
	if request.user.is_authenticated():
		django_logout(request)
		messages.success(request,'Tchau!')
		return render_to_response('login.html', locals(), context_instance=RequestContext(request))
	else:
		return render_to_response('index.html', locals(), context_instance=RequestContext(request))
Example #23
0
def logout(request):
	"""
	A simple request to check what the users auth status.
	Used to updated the user_block.
	"""
	django_logout(request)

	return handle_auth_block(request)
Example #24
0
def logout(request):
    """
    Logout and redirect to login view
    """
    django_logout(request)
    messages.success(request, _('Logout successful!'))

    return render(request, 'auth/login.html')
Example #25
0
def logout(request):

    if request.user.is_authenticated():
        if request.method == "POST":
            django_logout(request)
            return redirect("posts_main")
        else:
            return render(request, "users/logout.html")
Example #26
0
def logout(request):
    """
    Logs out the current user and clears their session data. Redirects to /.

    Doesn't throw any errors if the user isn't logged in.
    """
    django_logout(request)
    return HttpResponseRedirect('/')
Example #27
0
def logout(request):
    """Log out view.

    :param request: A django request object.
    :type request: request
    """
    django_logout(request)
    return HttpResponseRedirect(reverse('user_map:index'))
Example #28
0
 def logout(self, request, **kwargs):
     self.method_check(request, allowed=['get'])
     if request.user and request.user.is_authenticated():
         django_logout(request)
         return self.create_response(request, {'success': True})
     else:
         raise CustomBadRequest(code='invalid_request',
                                message="You are not logged in.")
Example #29
0
def auth_logout(request, next='/'):
    ''' View to handle a logout, which clears the session history as well. '''

    django_logout(request)
    if request.session.get("organization_id",None):
        del request.session["organization_id"]

    return HttpResponseRedirect(next)
Example #30
0
 def get(self, request):
     """
     Hace logout de un usuario y le redirige al login
     :param request: objeto HttpRequest
     :return: objeto HttpResponse de redirección al login
     """
     django_logout(request)
     return redirect('login')
Example #31
0
def logout(request):
    django_logout(request)
    print("Logging out")
    return redirect('/')
Example #32
0
def logout(request):
    if request.user.is_authenticated():
        django_logout(request)
    return HttpResponseRedirect("%slogout/" % settings.PGAUTH_REDIRECT)
    def logout_user(request):

        django_logout(request)
        return HttpResponseRedirect('/')
Example #34
0
 def get(self, request):
     if request.user.is_authenticated():
         django_logout(request)
     return redirect('photos_home')
Example #35
0
 def logout(self, request):
     """
     登出当前用户
     """
     django_logout(request)
     return Response({"success": True})
Example #36
0
def logout(request):
    """
    Log out view
    """
    django_logout(request)
    return redirect('/accounts/login')
Example #37
0
def logout(request):
    request.session.clear()
    django_logout(request)
    return HttpResponseRedirect(LOGIN_URL)
Example #38
0
 def logout(self, request):
     '''
     handle user's logout when POST to /api/accounts/logout/
     '''
     django_logout(request)
     return Response(status=status.HTTP_200_OK)
Example #39
0
def salir(request):
    request.session.clear()
    django_logout(request)
    return HttpResponseRedirect(LOGIN_REDIRECT_URL)
Example #40
0
def logout(request):
    logger.debug("in logout")
    logger.debug(">>>>>>>>>>>>>>>>>>" + str(request.user))
    audit(request, 'User logged out')
    django_logout(request)
    return redirect('/vital/login')
Example #41
0
def logout(request):
    django_logout(request)
    messages.success(request, 'You are now logged out')
    return redirect('index')
Example #42
0
def logout(request):
    if request.user.is_authenticated:
        django_logout(request)
        return redirect('login')
Example #43
0
def logout(request):
    print '*** logout ***'
    django_logout(request)
    return HttpResponseRedirect('/')
Example #44
0
def logout(request):
    django_logout(request)
    return redirect(reverse("index"))
Example #45
0
def logout(request):
    django_logout(request)
    return HttpResponseRedirect('/menu')
Example #46
0
 def post(self, request):
     django_logout(request)
     return Response(status=204)
Example #47
0
    def get(self,request):
		django_logout(request)
		return redirect('/')
Example #48
0
 def logout(self, request):
     django_logout(request)
Example #49
0
def logout(request):
    """
    Log out view
    """
    django_logout(request)
    return redirect('/home')
Example #50
0
def logout_view(request):
    if request.method == 'GET':
        request.session.token = ''
        django_logout(request)
        return redirect('UserJourney:login_view')
Example #51
0
def logout(request):
    session_key = request.session.session_key
    django_logout(request)
    return redirect('/admin/')
Example #52
0
def logout(request):
    django_logout(request)
    return HttpResponseRedirect(request.POST.get('next', '/'))
Example #53
0
def logout(request):
    django_logout(request)
    return render(request, "users/login.html",
                  {"message": "You are now logged out."})
Example #54
0
 def post(self, request):
     django_logout(request)
     return Response({'message': 'logout'}, status=204)
Example #55
0
def logout_process(request):
    django_logout(request)
    return render(request, 'out.html')
Example #56
0
def rcauth(request):
    # Only POST is supported on this URL.
    if request.method != 'POST':
        raise PermissionDenied

    # Rapid Connect authorization is disabled, so don't
    # process anything.
    if not settings.RAPID_CONNECT_ENABLED:
        raise PermissionDenied

    try:
        # Verifies signature and expiry time
        verified_jwt = jwt.decode(
            request.POST['assertion'],
            settings.RAPID_CONNECT_CONFIG['secret'],
            audience=settings.RAPID_CONNECT_CONFIG['aud'])

        # Check for a replay attack using the jti value.
        jti = verified_jwt['jti']
        if JTI.objects.filter(jti=jti).exists():
            logger.debug('Replay attack? ' + str(jti))
            request.session.pop('attributes', None)
            request.session.pop('jwt', None)
            request.session.pop('jws', None)
            django_logout(request)
            return redirect('/')
        else:
            JTI(jti=jti).save()

        if verified_jwt['aud'] == settings.RAPID_CONNECT_CONFIG['aud'] and \
           verified_jwt['iss'] == settings.RAPID_CONNECT_CONFIG['iss']:
            request.session['attributes'] = verified_jwt[
                'https://aaf.edu.au/attributes']
            request.session['jwt'] = verified_jwt
            request.session['jws'] = request.POST['assertion']

            institution_email = request.session['attributes']['mail']

            logger.debug('Successfully authenticated %s via Rapid Connect.' %
                         institution_email)

            # Create a user account and profile automatically. In future,
            # support blacklists and whitelists.
            first_name = request.session['attributes']['givenname']
            c_name = request.session['attributes'].get('cn', '').split(' ')
            if not first_name and len(c_name) > 1:
                first_name = c_name[0]
            user_args = {
                'id': institution_email.lower(),
                'email': institution_email.lower(),
                'password': pwgen.pwgen(),
                'first_name': first_name,
                'last_name': request.session['attributes']['surname'],
            }

            # Check for an email collision.
            edupersontargetedid = request.session['attributes'][
                'edupersontargetedid']
            for matching_user in UserProfile.objects.filter(
                    user__email__iexact=user_args['email']):
                if (matching_user.rapidConnectEduPersonTargetedID is not None
                        and matching_user.rapidConnectEduPersonTargetedID !=
                        edupersontargetedid):
                    del request.session['attributes']
                    del request.session['jwt']
                    del request.session['jws']
                    django_logout(request)
                    raise PermissionDenied

            user = auth_service.get_or_create_user(user_args)
            if user is not None:
                user.backend = 'django.contrib.auth.backends.ModelBackend'
                djauth.login(request, user)
                return redirect('/')
        else:
            del request.session['attributes']
            del request.session['jwt']
            del request.session['jws']
            django_logout(request)
            raise PermissionDenied  # Error: Not for this audience
    except jwt.ExpiredSignature:
        del request.session['attributes']
        del request.session['jwt']
        del request.session['jws']
        django_logout(request)
        raise PermissionDenied  # Error: Security cookie has expired
Example #57
0
def logout(request):
    django_logout(request)
    return redirect('post:post_list')
def logout(request):
    django_logout(request)
    return redirect('login')
Example #59
0
def logout(request):
    django_logout(request)
    return HttpResponseRedirect(reverse('home'))
Example #60
0
 def logout(self, request):
     django_logout(request)
     return Response({'success': True})