##// END OF EJS Templates
Renaming user cookie to username to better match usage.
MinRK -
Show More
@@ -43,13 +43,13 b' class AuthenticatedHandler(web.RequestHandler):'
43 """A RequestHandler with an authenticated user."""
43 """A RequestHandler with an authenticated user."""
44
44
45 def get_current_user(self):
45 def get_current_user(self):
46 user_id = self.get_secure_cookie("user")
46 user_id = self.get_secure_cookie("username")
47 # For now the user_id should not return empty, but it could eventually
47 # For now the user_id should not return empty, but it could eventually
48 if user_id == '':
48 if user_id == '':
49 user_id = 'anonymous'
49 user_id = 'anonymous'
50 if user_id is None:
50 if user_id is None:
51 # prevent extra Invalid cookie sig warnings:
51 # prevent extra Invalid cookie sig warnings:
52 self.clear_cookie('user')
52 self.clear_cookie('username')
53 if not self.application.password:
53 if not self.application.password:
54 user_id = 'anonymous'
54 user_id = 'anonymous'
55 return user_id
55 return user_id
@@ -75,7 +75,7 b' class LoginHandler(AuthenticatedHandler):'
75 def post(self):
75 def post(self):
76 pwd = self.get_argument('password', default=u'')
76 pwd = self.get_argument('password', default=u'')
77 if self.application.password and pwd == self.application.password:
77 if self.application.password and pwd == self.application.password:
78 self.set_secure_cookie('user', str(uuid.uuid4()))
78 self.set_secure_cookie('username', str(uuid.uuid4()))
79 url = self.get_argument('next', default='/')
79 url = self.get_argument('next', default='/')
80 self.redirect(url)
80 self.redirect(url)
81
81
@@ -208,7 +208,7 b' class AuthenticatedZMQStreamHandler(ZMQStreamHandler):'
208 self.on_message = self.on_first_message
208 self.on_message = self.on_first_message
209
209
210 def get_current_user(self):
210 def get_current_user(self):
211 user_id = self.get_secure_cookie("user")
211 user_id = self.get_secure_cookie("username")
212 if user_id == '' or (user_id is None and not self.application.password):
212 if user_id == '' or (user_id is None and not self.application.password):
213 user_id = 'anonymous'
213 user_id = 'anonymous'
214 return user_id
214 return user_id
General Comments 0
You need to be logged in to leave comments. Login now