BinaryONe commited on
Commit
424eeda
·
1 Parent(s): 8141b54
WebSSH/AppHandler.py CHANGED
@@ -50,16 +50,17 @@ class AppHandler(tornado.web.RequestHandler):
50
  with open(private_key_path, "r") as file:
51
  private_key = file.read()
52
  else:
53
- self.set_status(404)
54
- self.write("SSH key not found for existing user.")
55
- return
56
  else:
57
- self.set_status(404)
58
- self.write("User not found.")
59
- return
60
 
61
  # Return the private key to the user
62
  self.set_header('Content-Type', 'application/octet-stream')
63
  self.set_header('Content-Disposition', f'attachment; filename=id_rsa')
 
64
  self.write(private_key)
65
 
 
50
  with open(private_key_path, "r") as file:
51
  private_key = file.read()
52
  else:
53
+ #self.set_status(404)
54
+ #self.write("SSH key not found for existing user.")
55
+ return {response: 404, message: "SSH key not found for existing user."}
56
  else:
57
+ #self.set_status(404)
58
+ #self.write("User not found.")
59
+ return {response: 404, message:"User not found."}
60
 
61
  # Return the private key to the user
62
  self.set_header('Content-Type', 'application/octet-stream')
63
  self.set_header('Content-Disposition', f'attachment; filename=id_rsa')
64
+ self.set_header('response', f'ok')
65
  self.write(private_key)
66
 
WebSSH/templates/index.html CHANGED
@@ -87,6 +87,7 @@
87
  body: JSON.stringify({ username: username, password: password })
88
  })
89
  .then(response => {
 
90
  if (!response.ok) {
91
  throw new Error('Network response was not ok');
92
  }
 
87
  body: JSON.stringify({ username: username, password: password })
88
  })
89
  .then(response => {
90
+ console.log(response)
91
  if (!response.ok) {
92
  throw new Error('Network response was not ok');
93
  }