def redirect_if_authenticated(function):

    def wrap(controller, request, *args, **kwargs):
        if (request.user and request.user.is_authenticated):
            if ('redirect' in request.GET):
                return redirect(request.GET['redirect'])
            return redirect('app.web.admin.dashboard')
        return function(controller, request, *args, **kwargs)
    return wrap
def redirect_if_authenticated(function):

    def wrap(controller, request, *args, **kwargs):
        if (request.user and request.user.is_authenticated):
            if ('redirect' in request.GET):
                return redirect(request.GET['redirect'])
            return redirect('app.web.admin.dashboard')
        return function(controller, request, *args, **kwargs)
    return wrap