How to use the wilson/contrib/auth/utils.get_session_backend function in wilson

To help you get started, we’ve selected a few wilson examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chrisdickinson / wilson / lib / contrib / auth / middleware.js View on Github external
'processRequest':function(request) {
        if(request.add_user === undefined) {
            request.add_user = request_add_user;
            request.get_user = request_get_user;
            request._users = {};
        }

        var user_id = request.session.get(utils.get_session_key(this)),
            backend_name = request.session.get(utils.get_session_backend(this)),
            self = this;
        if(user_id !== undefined && backend_name !== undefined) {
            utils.get_user(self, backend_name, user_id, function(user) {
                request.add_user(self, user);
                request.attemptContinue();
            });
        } else {
            request.attemptContinue();
        }
    }
};
github chrisdickinson / wilson / lib / contrib / auth / views.js View on Github external
utils.authenticate(this, credentials, function(backend, user) {
            if(user === undefined || user instanceof utils.AnonymousUser) {
                renderToResponse(request)(kwargs.auth_form, {
                    'errors':'Could not log you in',
                });
            } else {
                var redirect_to = request.GET[kwargs.redirect_key] || '/';
                request.session.set(utils.get_session_backend(self), backend.name);
                request.session.set(utils.get_session_key(self), user.id);
                request.respond(new http.HttpResponseRedirect(redirect_to));

            }
        });
    } else {