Banning/Unbanning User does not update updatedAt field #1124

Closed
opened 2026-03-13 08:23:52 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @WorldOfMaze on GitHub (Apr 29, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Create an email/password user using the sign up.
  2. Call auth-client.admin.banUser or auth-client.admin.banUser with the new user's id.

Current vs. Expected behavior

I expected the updateAt field in the user table to be updated with the timestamp of the time the user was banned/unbanned. It was unchanged.

What version of Better Auth are you using?

1.2.7

Provide environment information

- OS: Windows 11
- Browser: Vivaldi
- Environment: Next JS 15.3.1
- React 19.1.0

Which area(s) are affected? (Select all that apply)

Client

Auth config (if applicable)

const auth = betterAuth({
	database: drizzleAdapter(db, {
		provider: 'pg',
		schema,
	}),
	session: {
		expiresIn: 60 * 60 * 24 * siteSettings.authSettings.sessionExpiresIn || 1,
		updateAge:
			60 * 60 * siteSettings.authSettings.sessionExpirationUpdateFrequency || 1,
		cookieCache: {
			enabled: true,
			maxAge: siteSettings.authSettings.cookieCacheMaxAge || 1,
		},
	},
	socialProviders: {
		google: {
			enabled: true,
			clientId: process.env.GOOGLE_CLIENT_ID as string,
			clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
		},
	},
	plugins: [
		openAPI(),
		admin({
			impersonationSessionDuration:
				siteSettings.authSettings.impersonationSessionDuration || 60 * 60,
		}),
	], // api/auth/reference
	emailAndPassword: {
		enabled: true,
		requireEmailVerification: true,
		sendResetPassword: async ({ user, url, token }, request) => {
			console.info(`Password Reset URL: ${url}`);
			console.info({ token });

			await sendEmail({
				to: user.email,
				subject: 'Reset your password',
				text: `Please click the following link to reset your password: ${url}`,
			});
		},
	},
	trustedOrigins: ['http://localhost:3000', 'http://192.168.1.215:3000'],
	emailVerification: {
		sendOnSignUp: true,
		autoSignInAfterVerification: true,
		sendVerificationEmail: async ({ user, token }) => {
			const verificationUrl = `${process.env.BETTER_AUTH_URL}/api/auth/verify-email?token=${token}&callback=${process.env.BETTER_AUTH_EMAIL_VERIFICATION_CALLBACK_URL}`;
			await sendEmail({
				to: user.email,
				subject: 'Please verify your email address',
				text: `Please click the following link to verify your email address: ${verificationUrl}`,
			});
		},
	},
} satisfies BetterAuthOptions);

Additional context

No response

Originally created by @WorldOfMaze on GitHub (Apr 29, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Create an email/password user using the sign up. 2. Call `auth-client.admin.banUser` or `auth-client.admin.banUser` with the new user's id. ### Current vs. Expected behavior I expected the `updateAt` field in the `user` table to be updated with the timestamp of the time the user was banned/unbanned. It was unchanged. ### What version of Better Auth are you using? 1.2.7 ### Provide environment information ```bash - OS: Windows 11 - Browser: Vivaldi - Environment: Next JS 15.3.1 - React 19.1.0 ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript const auth = betterAuth({ database: drizzleAdapter(db, { provider: 'pg', schema, }), session: { expiresIn: 60 * 60 * 24 * siteSettings.authSettings.sessionExpiresIn || 1, updateAge: 60 * 60 * siteSettings.authSettings.sessionExpirationUpdateFrequency || 1, cookieCache: { enabled: true, maxAge: siteSettings.authSettings.cookieCacheMaxAge || 1, }, }, socialProviders: { google: { enabled: true, clientId: process.env.GOOGLE_CLIENT_ID as string, clientSecret: process.env.GOOGLE_CLIENT_SECRET as string, }, }, plugins: [ openAPI(), admin({ impersonationSessionDuration: siteSettings.authSettings.impersonationSessionDuration || 60 * 60, }), ], // api/auth/reference emailAndPassword: { enabled: true, requireEmailVerification: true, sendResetPassword: async ({ user, url, token }, request) => { console.info(`Password Reset URL: ${url}`); console.info({ token }); await sendEmail({ to: user.email, subject: 'Reset your password', text: `Please click the following link to reset your password: ${url}`, }); }, }, trustedOrigins: ['http://localhost:3000', 'http://192.168.1.215:3000'], emailVerification: { sendOnSignUp: true, autoSignInAfterVerification: true, sendVerificationEmail: async ({ user, token }) => { const verificationUrl = `${process.env.BETTER_AUTH_URL}/api/auth/verify-email?token=${token}&callback=${process.env.BETTER_AUTH_EMAIL_VERIFICATION_CALLBACK_URL}`; await sendEmail({ to: user.email, subject: 'Please verify your email address', text: `Please click the following link to verify your email address: ${verificationUrl}`, }); }, }, } satisfies BetterAuthOptions); ``` ### Additional context _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1124