Server IP : / Your IP : 10.244.4.16 [ Web Server : nginx/1.25.3 System : Linux escuela-portal-app-54f56585bc-kst6g 5.15.0-1084-azure #93-Ubuntu SMP Sat Mar 15 14:12:29 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.13 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/449/cwd/app/vendor/laravel/fortify/src/ |
Upload File : |
<?php namespace Laravel\Fortify; use BaconQrCode\Renderer\Color\Rgb; use BaconQrCode\Renderer\Image\SvgImageBackEnd; use BaconQrCode\Renderer\ImageRenderer; use BaconQrCode\Renderer\RendererStyle\Fill; use BaconQrCode\Renderer\RendererStyle\RendererStyle; use BaconQrCode\Writer; use Laravel\Fortify\Contracts\TwoFactorAuthenticationProvider; trait TwoFactorAuthenticatable { /** * Determine if two-factor authentication has been enabled. * * @return bool */ public function hasEnabledTwoFactorAuthentication() { if (Fortify::confirmsTwoFactorAuthentication()) { return ! is_null($this->two_factor_secret) && ! is_null($this->two_factor_confirmed_at); } return ! is_null($this->two_factor_secret); } /** * Get the user's two factor authentication recovery codes. * * @return array */ public function recoveryCodes() { return json_decode(decrypt($this->two_factor_recovery_codes), true); } /** * Replace the given recovery code with a new one in the user's stored codes. * * @param string $code * @return void */ public function replaceRecoveryCode($code) { $this->forceFill([ 'two_factor_recovery_codes' => encrypt(str_replace( $code, RecoveryCode::generate(), decrypt($this->two_factor_recovery_codes) )), ])->save(); } /** * Get the QR code SVG of the user's two factor authentication QR code URL. * * @return string */ public function twoFactorQrCodeSvg() { $svg = (new Writer( new ImageRenderer( new RendererStyle(192, 0, null, null, Fill::uniformColor(new Rgb(255, 255, 255), new Rgb(45, 55, 72))), new SvgImageBackEnd ) ))->writeString($this->twoFactorQrCodeUrl()); return trim(substr($svg, strpos($svg, "\n") + 1)); } /** * Get the two factor authentication QR code URL. * * @return string */ public function twoFactorQrCodeUrl() { return app(TwoFactorAuthenticationProvider::class)->qrCodeUrl( config('app.name'), $this->{Fortify::username()}, decrypt($this->two_factor_secret) ); } }