singleton(LoginViewResponse::class, function () use ($view) { return new SimpleViewResponse($view); }); } /** * Specify which view should be used as the two factor authentication challenge view. * * @param callable|string $view * @return void */ public static function twoFactorChallengeView($view) { app()->singleton(TwoFactorChallengeViewResponse::class, function () use ($view) { return new SimpleViewResponse($view); }); } /** * Specify which view should be used as the new password view. * * @param callable|string $view * @return void */ public static function resetPasswordView($view) { app()->singleton(ResetPasswordViewResponse::class, function () use ($view) { return new SimpleViewResponse($view); }); } /** * Specify which view should be used as the registration view. * * @param callable|string $view * @return void */ public static function registerView($view) { app()->singleton(RegisterViewResponse::class, function () use ($view) { return new SimpleViewResponse($view); }); } /** * Specify which view should be used as the email verification prompt. * * @param callable|string $view * @return void */ public static function verifyEmailView($view) { app()->singleton(VerifyEmailViewResponse::class, function () use ($view) { return new SimpleViewResponse($view); }); } /** * Specify which view should be used as the password confirmation prompt. * * @param callable|string $view * @return void */ public static function confirmPasswordView($view) { app()->singleton(ConfirmPasswordViewResponse::class, function () use ($view) { return new SimpleViewResponse($view); }); } /** * Specify which view should be used as the request password reset link view. * * @param callable|string $view * @return void */ public static function requestPasswordResetLinkView($view) { app()->singleton(RequestPasswordResetLinkViewResponse::class, function () use ($view) { return new SimpleViewResponse($view); }); } /** * Register a callback that is responsible for building the authentication pipeline array. * * @param callable $callback * @return void */ public static function loginThrough(callable $callback) { static::authenticateThrough($callback); } /** * Register a callback that is responsible for building the authentication pipeline array. * * @param callable $callback * @return void */ public static function authenticateThrough(callable $callback) { static::$authenticateThroughCallback = $callback; } /** * Register a callback that is responsible for validating incoming authentication credentials. * * @param callable $callback * @return void */ public static function authenticateUsing(callable $callback) { static::$authenticateUsingCallback = $callback; } /** * Register a class / callback that should be used to redirect users for two factor authentication. * * @param callable|string $callback * @return void */ public static function redirectUserForTwoFactorAuthenticationUsing($callback) { app()->scoped(RedirectsIfTwoFactorAuthenticatable::class, $callback); } /** * Register a callback that is responsible for confirming existing user passwords as valid. * * @param callable $callback * @return void */ public static function confirmPasswordsUsing(callable $callback) { static::$confirmPasswordsUsingCallback = $callback; } /** * Register a class / callback that should be used to create new users. * * @param callable|string $callback * @return void */ public static function createUsersUsing($callback) { app()->singleton(CreatesNewUsers::class, $callback); } /** * Register a class / callback that should be used to update user profile information. * * @param callable|string $callback * @return void */ public static function updateUserProfileInformationUsing($callback) { app()->singleton(UpdatesUserProfileInformation::class, $callback); } /** * Register a class / callback that should be used to update user passwords. * * @param callable|string $callback * @return void */ public static function updateUserPasswordsUsing($callback) { app()->singleton(UpdatesUserPasswords::class, $callback); } /** * Register a class / callback that should be used to reset user passwords. * * @param callable|string $callback * @return void */ public static function resetUserPasswordsUsing($callback) { app()->singleton(ResetsUserPasswords::class, $callback); } /** * Register a callback that should be used to generate recovery codes. * * @param callable $callback * @return void */ public static function generateRecoveryCodesUsing(callable $callback) { static::$recoveryCodeGenerator = $callback; } /** * Determine if Fortify is confirming two factor authentication configurations. * * @return bool */ public static function confirmsTwoFactorAuthentication() { return Features::enabled(Features::twoFactorAuthentication()) && Features::optionEnabled(Features::twoFactorAuthentication(), 'confirm'); } /** * Set the encrypter instance that will be used to encrypt attributes. * * @param \Illuminate\Contracts\Encryption\Encrypter|null $encrypter * @return static */ public static function encryptUsing($encrypter) { static::$encrypter = $encrypter; return new static; } /** * Get the current encrypter being used by the model. * * @return \Illuminate\Contracts\Encryption\Encrypter */ public static function currentEncrypter() { return static::$encrypter ?? Model::$encrypter ?? Crypt::getFacadeRoot(); } /** * Configure Fortify to not register its routes. * * @return static */ public static function ignoreRoutes() { static::$registersRoutes = false; return new static; } }