refactor: integrate Better-Auth for authentication and remove Supabase dependencies
This commit is contained in:
@@ -11,9 +11,9 @@ function getSuperAdminEmails(): Set<string> {
|
||||
}
|
||||
|
||||
export const requireSuperAdmin: MiddlewareHandler<AppEnv> = async (c, next) => {
|
||||
const authUser = c.get('authUser');
|
||||
const role = typeof authUser.app_metadata?.role === 'string' ? authUser.app_metadata.role : null;
|
||||
const email = authUser.email?.toLowerCase();
|
||||
const user = c.get('user');
|
||||
const role = (user as any).role || 'member';
|
||||
const email = user.email.toLowerCase();
|
||||
|
||||
if (role === 'super_admin') {
|
||||
await next();
|
||||
|
||||
Reference in New Issue
Block a user