How to use the wilson/contrib/auth/utils.AnonymousUser 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 / 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 {
github chrisdickinson / wilson / lib / contrib / auth / middleware.js View on Github external
var request_get_user = function(from) {
    var users = this._users || {},
        target = from instanceof Object ? from.name : from;
    for(var appName in users) if(users.hasOwnProperty(appName)) {
        if(appName === target) {
            return users[appName];
        }
    }
    return new utils.AnonymousUser();
};