Fix jwt-token
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
const bcrypt = require('bcrypt');
|
const bcrypt = require('bcryptjs');
|
||||||
const { User, Device, AlertRule } = require('./models');
|
const { User, Device, AlertRule } = require('./models');
|
||||||
|
|
||||||
async function seedDatabase() {
|
async function seedDatabase() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const twilio = require('twilio');
|
const twilio = require('twilio');
|
||||||
const { AlertRule, AlertLog, User, Device } = require('../models');
|
const { AlertRule, AlertLog, User, Device, DroneDetection } = require('../models');
|
||||||
const { Op } = require('sequelize');
|
const { Op } = require('sequelize');
|
||||||
|
|
||||||
class AlertService {
|
class AlertService {
|
||||||
@@ -97,19 +97,19 @@ class AlertService {
|
|||||||
const authToken = process.env.TWILIO_AUTH_TOKEN;
|
const authToken = process.env.TWILIO_AUTH_TOKEN;
|
||||||
const phoneNumber = process.env.TWILIO_PHONE_NUMBER;
|
const phoneNumber = process.env.TWILIO_PHONE_NUMBER;
|
||||||
|
|
||||||
// If any Twilio credential is missing, disable SMS functionality
|
// If any Twilio credential is missing or empty, disable SMS functionality
|
||||||
if (!accountSid || !authToken || !phoneNumber ||
|
if (!accountSid || !authToken || !phoneNumber ||
|
||||||
accountSid.trim() === '' || authToken.trim() === '' || phoneNumber.trim() === '') {
|
accountSid.trim() === '' || authToken.trim() === '' || phoneNumber.trim() === '') {
|
||||||
console.log('📱 Twilio credentials not configured - SMS alerts disabled');
|
console.log('📱 Twilio credentials not configured - SMS alerts disabled (Development Mode)');
|
||||||
console.log('ℹ️ To enable SMS alerts, set TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_PHONE_NUMBER');
|
console.log('ℹ️ To enable SMS alerts, set TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_PHONE_NUMBER');
|
||||||
this.twilioEnabled = false;
|
this.twilioEnabled = false;
|
||||||
this.twilioClient = null;
|
this.twilioClient = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate Twilio Account SID format
|
// Validate Twilio Account SID format (only if provided)
|
||||||
if (!accountSid.startsWith('AC')) {
|
if (accountSid && !accountSid.startsWith('AC')) {
|
||||||
console.log('⚠️ Invalid Twilio Account SID format - SMS alerts disabled');
|
console.log('⚠️ Invalid Twilio Account SID format - SMS alerts disabled (Development Mode)');
|
||||||
console.log('ℹ️ Account SID must start with "AC"');
|
console.log('ℹ️ Account SID must start with "AC"');
|
||||||
this.twilioEnabled = false;
|
this.twilioEnabled = false;
|
||||||
this.twilioClient = null;
|
this.twilioClient = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user