Oinweb / fly-django

Financial Literacy for Youth App
https://www.flyapp.ca
BSD 2-Clause "Simplified" License
12 stars 9 forks source link

HTML5 Storage bug #103

Closed bartmika closed 8 years ago

bartmika commented 8 years ago

Hi @viralrain after investigating issues #88 and #93 and I've discovered it's HTML5 Storage releated which created in the function loadUserData() function. Here is the code where this 'null' error was created.

function saveKeyToStorage(login_type,token){if(typeof(Storage)!=="undefined"){localStorage.setItem("network",login_type);localStorage.setItem("token",token);}else{alert('No local storage');}}
function saveUserToStorage(acc_id,name,fname,lname,email,img_url){localStorage.setItem('acc_id',acc_id);localStorage.setItem('name',name);localStorage.setItem('fname',fname);localStorage.setItem('lname',lname);localStorage.setItem('email',email);localStorage.setItem('img_url',img_url);}
function loadUserData(){var name=localStorage.getItem('name');var img_url=localStorage.getItem('img_url');$('.user-image').attr('src',img_url);$('.greeting').text('Hello, '+name);}

I believe we use this code when we are using Social Auth. The solution would be to remove this code and just use the Django Template "first_name" / "last_name" values.