Browse Source

More cookie fixes

staff_tasks_refactor
Nathan Wilson 8 years ago
parent
commit
be37479610
3 changed files with 8 additions and 3 deletions
  1. +1
    -1
      misc.py
  2. +1
    -1
      staff.py
  3. +6
    -1
      wakaba3.js

+ 1
- 1
misc.py View File

@@ -200,7 +200,7 @@ def make_cookies(**kwargs):

cookies = environ['waka.cookies']
for key, value in kwargs.iteritems():
cookies[key] = urllib.quote(value.encode('utf-8'))
cookies[key] = urllib.quote(value.encode('unicode-escape'))
cookies[key]['expires'] = expire_date
cookies[key]['path'] = path



+ 1
- 1
staff.py View File

@@ -39,7 +39,7 @@ class LoginData(object):
misc.make_cookies(wakaadminsave='1', wakaadmin=self.cookie,
expires=time.time()+SAVED_LOGIN_EXPIRE)
else:
misc.make_cookies(wakaadminsave='0', wakaadmin=self.cookie,
misc.make_cookies(wakaadminsave='', wakaadmin=self.cookie,
expires=time.time()+UNSAVED_LOGIN_EXPIRE)

# Class for representing staff


+ 6
- 1
wakaba3.js View File

@@ -4,7 +4,12 @@ function get_cookie(name)
{
var regexp=new RegExp("(^|;\\s+)"+name+"=(.*?)(;|$)");
var hit=regexp.exec(document.cookie);
if(hit&&hit.length>2) return unescape(hit[2]);
if(hit&&hit.length>2)
{
var unicode_esc = unescape(hit[2]);
eval("var ret_val = '" + unicode_esc + "'");
return ret_val;
}
else return '';
}
};


Loading…
Cancel
Save