Allow a user to pick existing sshkeys from ~/.ssh

This commit is contained in:
Nick O'Leary
2018-01-10 17:37:41 +00:00
parent 00a396014b
commit 6516e0dfd2
8 changed files with 268 additions and 131 deletions

View File

@@ -84,7 +84,7 @@ module.exports = {
app.post("/", needsPermission("settings.write"), function(req,res) {
var username = getUsername(req.user);
// console.log('req.body:', req.body);
if ( req.body && req.body.name ) {
if ( req.body && req.body.name && /^[a-zA-Z0-9\-_]+$/.test(req.body.name)) {
runtime.storage.sshkeys.generateSSHKey(username, req.body)
.then(function(name) {
// console.log('generate key --- success name:', name);