base default cookie name on request host+port

instead of random.

The random cookie name meant that every time you restarted the notebook it would get a new key in the cookie for the same host, resulting in an ever-growing cookie full of obsolete data.
This commit is contained in:
MinRK 2013-05-28 13:23:01 -07:00
parent 695d7af2a5
commit 78d5827c47
2 changed files with 4 additions and 2 deletions

View File

@ -147,7 +147,10 @@ class AuthenticatedHandler(RequestHandler):
@property
def cookie_name(self):
return self.settings.get('cookie_name', '')
default_cookie_name = 'username-{host}'.format(
host=self.request.host,
).replace(':', '-')
return self.settings.get('cookie_name', default_cookie_name)
@property
def password(self):

View File

@ -166,7 +166,6 @@ class NotebookWebApplication(web.Application):
# authentication
cookie_secret=os.urandom(1024),
login_url=url_path_join(base_project_url,'/login'),
cookie_name='username-%s' % uuid.uuid4(),
read_only=ipython_app.read_only,
password=ipython_app.password,