completionId: cgen-735b602f6402482f9552d805924b3558
cgen-735b602f6402482f9552d805924b3558
This commit is contained in:
parent
7435d98410
commit
f3808714c1
1 changed files with 14 additions and 3 deletions
|
|
@ -48,12 +48,23 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
|
|||
const result = await admin
|
||||
.from("user_profiles")
|
||||
.select(userFields)
|
||||
.ilike("username", `%${username}%`)
|
||||
.limit(1)
|
||||
.eq("username", username)
|
||||
.single();
|
||||
user = result.data;
|
||||
} catch (e) {
|
||||
// Continue to ID lookup
|
||||
console.log("[Passport] Username exact match failed, trying ilike:", e?.message);
|
||||
// Try case-insensitive match
|
||||
try {
|
||||
const result2 = await admin
|
||||
.from("user_profiles")
|
||||
.select(userFields)
|
||||
.ilike("username", username)
|
||||
.limit(1)
|
||||
.single();
|
||||
user = result2.data;
|
||||
} catch (e2) {
|
||||
// Continue to ID lookup
|
||||
}
|
||||
}
|
||||
|
||||
// If not found by username, try by exact ID match
|
||||
|
|
|
|||
Loading…
Reference in a new issue