home-erp

git clone git://archive.git.mtrnord.blog/MTRNord/home-erp.git
Log | Files | Refs | README

confirm-password.blade.php (1786B)


      1 <?php
      2 
      3 use App\Providers\RouteServiceProvider;
      4 use Illuminate\Validation\ValidationException;
      5 use Livewire\Attributes\Layout;
      6 use Livewire\Attributes\Rule;
      7 use Livewire\Volt\Component;
      8 
      9 new #[Layout('layouts.guest')] class extends Component
     10 {
     11     #[Rule(['required', 'string'])]
     12     public string $password = '';
     13 
     14     public function confirmPassword(): void
     15     {
     16         $this->validate();
     17 
     18         if (! auth()->guard('web')->validate([
     19             'email' => auth()->user()->email,
     20             'password' => $this->password,
     21         ])) {
     22             throw ValidationException::withMessages([
     23                 'password' => __('auth.password'),
     24             ]);
     25         }
     26 
     27         session(['auth.password_confirmed_at' => time()]);
     28 
     29         $this->redirect(
     30             session('url.intended', RouteServiceProvider::HOME),
     31             navigate: true
     32         );
     33     }
     34 }; ?>
     35 
     36 <div>
     37     <div class="mb-4 text-sm text-gray-600 dark:text-gray-400">
     38         {{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
     39     </div>
     40 
     41     <form wire:submit="confirmPassword">
     42         <!-- Password -->
     43         <div>
     44             <x-input-label for="password" :value="__('Password')" />
     45 
     46             <x-text-input wire:model="password"
     47                           id="password"
     48                           class="block mt-1 w-full"
     49                           type="password"
     50                           name="password"
     51                           required autocomplete="current-password" />
     52 
     53             <x-input-error :messages="$errors->get('password')" class="mt-2" />
     54         </div>
     55 
     56         <div class="flex justify-end mt-4">
     57             <x-primary-button>
     58                 {{ __('Confirm') }}
     59             </x-primary-button>
     60         </div>
     61     </form>
     62 </div>