Skip to content

Commit 70bda61

Browse files
authored
Merge pull request #153 from linux-credentials/demo-tweaks
Demo tweaks
2 parents a584225 + 2c32719 commit 70bda61

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

demo_client/gui.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ async def register_passkey(self):
220220
)
221221

222222
try:
223-
handle = window_handle[window_handle.find(":") + 1 :]
224-
toplevel.unexport_handle(handle)
223+
if isinstance(toplevel, GdkWayland.WaylandToplevel):
224+
toplevel.drop_exported_handle(handle)
225225
except Exception as err:
226226
print(err)
227227

@@ -263,15 +263,24 @@ async def assert_passkey(self):
263263
username = self.username.get_text()
264264
if username:
265265
print(f"Using username-flow: {username}")
266-
sql = """
266+
db = connect_db()
267+
get_user_sql = """
268+
select user_id from users u
269+
where u.username = ?
270+
"""
271+
272+
get_user_creds_sql = """
267273
select p.user_handle, cred_id, backup_eligible, backup_state, cose_pub_key, sign_count
268274
from user_passkeys p
269275
inner join users u on u.user_handle = p.user_handle
270276
where u.username = ?
271277
"""
272-
db = connect_db()
273278
with closing(db.cursor()) as cur:
274-
cur.execute(sql, (username,))
279+
cur.execute(get_user_sql, (username,))
280+
if not cur.fetchone():
281+
raise Exception(f"No account found for username: {username}")
282+
283+
cur.execute(get_user_creds_sql, (username,))
275284
user_creds = []
276285
for row in cur.fetchall():
277286
[

0 commit comments

Comments
 (0)