mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-24 08:01:56 -05:00
fix: use the default table names on username and phone auth
This commit is contained in:
@@ -34,7 +34,7 @@ const createTransform = (
|
||||
const schemaModel = schema[model];
|
||||
if (!schemaModel) {
|
||||
throw new BetterAuthError(
|
||||
`[# Drizzle Adapter]: The model "${modelName}" was not found in the schema object. Please pass the schema directly to the adapter options.`,
|
||||
`[# Drizzle Adapter]: The model "${model}" was not found in the schema object. Please pass the schema directly to the adapter options.`,
|
||||
);
|
||||
}
|
||||
return schemaModel;
|
||||
|
||||
@@ -319,7 +319,7 @@ export const phoneNumber = (options?: {
|
||||
}
|
||||
|
||||
let user = await ctx.context.adapter.findOne<UserWithPhoneNumber>({
|
||||
model: ctx.context.tables.user.modelName,
|
||||
model: "user",
|
||||
where: [
|
||||
{
|
||||
value: ctx.body.phoneNumber,
|
||||
|
||||
@@ -21,7 +21,7 @@ export const username = () => {
|
||||
},
|
||||
async (ctx) => {
|
||||
const user = await ctx.context.adapter.findOne<User>({
|
||||
model: ctx.context.tables.user.modelName,
|
||||
model: "user",
|
||||
where: [
|
||||
{
|
||||
field: "username",
|
||||
@@ -40,15 +40,11 @@ export const username = () => {
|
||||
model: "account",
|
||||
where: [
|
||||
{
|
||||
field:
|
||||
ctx.context.tables.account.fields.userId.fieldName ||
|
||||
"userId",
|
||||
field: "userId",
|
||||
value: user.id,
|
||||
},
|
||||
{
|
||||
field:
|
||||
ctx.context.tables.account.fields.providerId.fieldName ||
|
||||
"providerId",
|
||||
field: "providerId",
|
||||
value: "credential",
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user