File size: 994 Bytes
2295c9c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require('dotenv').config();
const { createClient } = require('@supabase/supabase-js');
const bcrypt = require('bcryptjs');

const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_KEY);

async function resetPassword() {
  const email = 'yogesh234456@gmail.com';
  const newPass = '123456';
  const hashed = await bcrypt.hash(newPass, 10);
  
  console.log(`🔄 Resetting password for: ${email}`);
  
  const { data, error } = await supabase
    .from('users')
    .update({ password: hashed })
    .ilike('email', email)
    .select();
    
  if (error) {
    console.error('❌ Reset Failed:', error.message);
  } else if (data.length === 0) {
    console.warn('⚠️ User not found. Creating new user...');
    await supabase.from('users').insert([{ email, password: hashed, role: 'user', plan: 'ultra' }]);
    console.log('✅ New user created with password: 123456');
  } else {
    console.log('✅ Password successfully reset to: 123456');
  }
}

resetPassword();