fix csrftoken cookie issue

This commit is contained in:
Tim Daubenschütz 2015-07-16 17:04:37 +02:00
parent d56286a472
commit f12d2273d5
3 changed files with 16 additions and 4 deletions

View File

@ -51,6 +51,9 @@
ga('create', 'UA-60614729-2', 'auto');
</script>
<!-- Logging for sentry -->
<script src="//cdn.ravenjs.com/1.1.19/raven.min.js"></script>
<!-- Intercom library -->
<script>
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;

View File

@ -32,6 +32,12 @@ requests.defaults({
}
});
Raven.config('https://0955da3388c64ab29bd32c2a429f9ef4@app.getsentry.com/48351', {
// pass along the version of your application
release: '1.0.0'
}).install();
window.onerror = Raven.process;
class AppGateway {

View File

@ -64,11 +64,14 @@ export function status(response) {
}
export function getCookie(name) {
let value = '; ' + document.cookie;
let parts = value.split('; ' + name + '=');
if (parts.length === 2) {
return parts.pop().split(';').shift();
let parts = document.cookie.split(';');
for(let i = 0; i < parts.length; i++) {
if(parts[i].indexOf('csrftoken=') > -1) {
return parts[i].split('=').pop();
}
}
throw new Error('There wasn\'t a cookie with name: ' + name + ' found.');
}
/*