VNC authentication works, although there is no UI for adding passwords

yet. Direct database manipulation is required for now.
This commit is contained in:
Simo Kinnunen
2015-10-13 03:14:18 +09:00
parent a902c66131
commit 5b5520b705
8 changed files with 332 additions and 32 deletions

View File

@@ -100,6 +100,27 @@ dbapi.lookupUserByAdbFingerprint = function(fingerprint) {
})
}
dbapi.lookupUserByVncAuthResponse = function(response, serial) {
return db.run(r.table('vncauth').getAll([response, serial], {
index: 'responsePerDevice'
})
.eqJoin('userId', r.table('users'))('right')
.pluck('email', 'name', 'group'))
.then(function(cursor) {
return cursor.toArray()
})
.then(function(groups) {
switch (groups.length) {
case 1:
return groups[0]
case 0:
return null
default:
throw new Error('Found multiple users with the same VNC response')
}
})
}
dbapi.loadGroup = function(email) {
return db.run(r.table('devices').getAll(email, {
index: 'owner'