commit c873b50522c3ce97107cd83efdd79639569b7e86
parent a576a41ea42556c70e838ca014c16940d717110f
Author: Sheng <webmaster0115@gmail.com>
Date: Mon, 8 Oct 2018 20:49:53 +0800
Renamed attribute filename to privatekey_filename
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/webssh/handler.py b/webssh/handler.py
@@ -71,7 +71,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
self.policy = policy
self.host_keys_settings = host_keys_settings
self.ssh_client = self.get_ssh_client()
- self.filename = None
+ self.privatekey_filename = None
self.result = dict(id=None, status=None, encoding=None)
def write_error(self, status_code, **kwargs):
@@ -100,7 +100,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
name = 'privatekey'
lst = self.request.files.get(name) # multipart form
if lst:
- self.filename = lst[0]['filename']
+ self.privatekey_filename = lst[0]['filename']
data = lst[0]['body']
value = self.decode_argument(data, name=name).strip()
else:
@@ -108,7 +108,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
if len(value) > KEY_MAX_SIZE:
raise InvalidValueError(
- 'Invalid private key: {}'.format(self.filename)
+ 'Invalid private key: {}'.format(self.privatekey_filename)
)
return value
@@ -179,8 +179,11 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
username = self.get_value('username')
password = self.get_argument('password', u'')
privatekey = self.get_privatekey()
- pkey = self.get_pkey_obj(privatekey, password, self.filename) \
- if privatekey else None
+ if privatekey:
+ pkey = self.get_pkey_obj(privatekey, password,
+ self.privatekey_filename)
+ else:
+ pkey = None
args = (hostname, port, username, password, pkey)
logging.debug(args)
return args