···1import {
2 type AuthenticationResponseJSON,
003 type PublicKeyCredentialCreationOptionsJSON,
4 type PublicKeyCredentialRequestOptionsJSON,
5 type RegistrationResponseJSON,
6 type VerifiedAuthenticationResponse,
7 type VerifiedRegistrationResponse,
8- generateAuthenticationOptions,
9- generateRegistrationOptions,
10 verifyAuthenticationResponse,
11 verifyRegistrationResponse,
12} from "@simplewebauthn/server";
···381382 // Check if user exists and is active
383 const user = db
384- .query("SELECT id, status, provisioned_via_ldap, last_ldap_verified_at FROM users WHERE username = ?")
385- .get(username) as { id: number; status: string; provisioned_via_ldap: number; last_ldap_verified_at: number | null } | undefined;
000000000386387 if (!user) {
388 return Response.json({ error: "Invalid credentials" }, { status: 401 });
···405 const existsInLdap = await checkLdapUser(username);
406 if (!existsInLdap) {
407 // User no longer exists in LDAP - suspend the account
408- db.query("UPDATE users SET status = 'suspended' WHERE id = ?").run(user.id);
00409 return Response.json(
410 { error: "Invalid credentials" },
411 { status: 401 },
···1import {
2 type AuthenticationResponseJSON,
3+ generateAuthenticationOptions,
4+ generateRegistrationOptions,
5 type PublicKeyCredentialCreationOptionsJSON,
6 type PublicKeyCredentialRequestOptionsJSON,
7 type RegistrationResponseJSON,
8 type VerifiedAuthenticationResponse,
9 type VerifiedRegistrationResponse,
0010 verifyAuthenticationResponse,
11 verifyRegistrationResponse,
12} from "@simplewebauthn/server";
···381382 // Check if user exists and is active
383 const user = db
384+ .query(
385+ "SELECT id, status, provisioned_via_ldap, last_ldap_verified_at FROM users WHERE username = ?",
386+ )
387+ .get(username) as
388+ | {
389+ id: number;
390+ status: string;
391+ provisioned_via_ldap: number;
392+ last_ldap_verified_at: number | null;
393+ }
394+ | undefined;
395396 if (!user) {
397 return Response.json({ error: "Invalid credentials" }, { status: 401 });
···414 const existsInLdap = await checkLdapUser(username);
415 if (!existsInLdap) {
416 // User no longer exists in LDAP - suspend the account
417+ db.query("UPDATE users SET status = 'suspended' WHERE id = ?").run(
418+ user.id,
419+ );
420 return Response.json(
421 { error: "Invalid credentials" },
422 { status: 401 },