mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-02 04:16:38 -05:00
feat(anonymous): update generateName to support returning a promise (#3259)
This commit is contained in:
@@ -58,7 +58,7 @@ export interface AnonymousOptions {
|
||||
},
|
||||
AuthContext
|
||||
>,
|
||||
) => string;
|
||||
) => Promise<string> | string;
|
||||
/**
|
||||
* Custom schema for the anonymous plugin
|
||||
*/
|
||||
@@ -121,7 +121,7 @@ export const anonymous = (options?: AnonymousOptions) => {
|
||||
options || {};
|
||||
const id = ctx.context.generateId({ model: "user" });
|
||||
const email = `temp-${id}@${emailDomainName}`;
|
||||
const name = options?.generateName?.(ctx) || "Anonymous";
|
||||
const name = (await options?.generateName?.(ctx)) || "Anonymous";
|
||||
const newUser = await ctx.context.internalAdapter.createUser(
|
||||
{
|
||||
email,
|
||||
|
||||
Reference in New Issue
Block a user