Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 {
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();
};