mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-05 16:02:34 +00:00
User management (#185)
This commit is contained in:
@ -0,0 +1,78 @@
|
||||
<x-card>
|
||||
<x-slot name="title">
|
||||
{{ __("Two Factor Authentication") }}
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="description">
|
||||
{{ __("Here you can activate 2FA to secure your account") }}
|
||||
</x-slot>
|
||||
|
||||
<div id="two-factor">
|
||||
@if (! auth()->user()->two_factor_secret)
|
||||
{{-- Enable 2FA --}}
|
||||
<form
|
||||
hx-post="{{ route("two-factor.enable") }}"
|
||||
hx-target="#two-factor"
|
||||
hx-select="#two-factor"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@csrf
|
||||
|
||||
<x-primary-button type="submit">
|
||||
{{ __("Enable Two-Factor") }}
|
||||
</x-primary-button>
|
||||
</form>
|
||||
@else
|
||||
{{-- Disable 2FA --}}
|
||||
<form
|
||||
hx-post="{{ route("two-factor.disable") }}"
|
||||
hx-target="#two-factor"
|
||||
hx-select="#two-factor"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@csrf
|
||||
@method("DELETE")
|
||||
|
||||
<x-danger-button type="submit">
|
||||
{{ __("Disable Two-Factor") }}
|
||||
</x-danger-button>
|
||||
</form>
|
||||
|
||||
@if (session("status") == "two-factor-authentication-enabled")
|
||||
<div class="mt-5">
|
||||
{{ __('Two factor authentication is now enabled. Scan the following QR code using your phone\'s authenticator application.') }}
|
||||
</div>
|
||||
|
||||
<div class="mt-5">
|
||||
{!! auth()->user()->twoFactorQrCodeSvg() !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Show 2FA Recovery Codes --}}
|
||||
<div class="mt-5">
|
||||
{{ __("Store these recovery codes in a secure password manager. They can be used to recover access to your account if your two factor authentication device is lost.") }}
|
||||
</div>
|
||||
|
||||
<div class="mt-5 rounded-md border border-gray-100 p-2 dark:border-gray-700">
|
||||
@foreach (json_decode(decrypt(auth()->user()->two_factor_recovery_codes), true) as $code)
|
||||
<div class="mt-2">{{ $code }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{-- Regenerate 2FA Recovery Codes --}}
|
||||
<form
|
||||
class="mt-5"
|
||||
hx-post="{{ route("two-factor.recovery-codes") }}"
|
||||
hx-target="#two-factor"
|
||||
hx-select="#two-factor"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
@csrf
|
||||
|
||||
<x-primary-button type="submit">
|
||||
{{ __("Regenerate Recovery Codes") }}
|
||||
</x-primary-button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</x-card>
|
69
resources/views/profile/partials/update-password.blade.php
Normal file
69
resources/views/profile/partials/update-password.blade.php
Normal file
@ -0,0 +1,69 @@
|
||||
<x-card>
|
||||
<x-slot name="title">
|
||||
{{ __("Update Password") }}
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="description">
|
||||
{{ __("Ensure your account is using a long, random password to stay secure.") }}
|
||||
</x-slot>
|
||||
|
||||
<form
|
||||
id="update-password"
|
||||
class="mt-6 space-y-6"
|
||||
hx-post="{{ route("profile.password") }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-select="#update-password"
|
||||
hx-trigger="submit"
|
||||
hx-ext="disable-element"
|
||||
hx-disable-element="#btn-save-password"
|
||||
>
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<x-input-label for="current_password" :value="__('Current Password')" />
|
||||
<x-text-input
|
||||
id="current_password"
|
||||
name="current_password"
|
||||
type="password"
|
||||
class="mt-1 block w-full"
|
||||
autocomplete="current-password"
|
||||
/>
|
||||
@error("current_password")
|
||||
<x-input-error class="mt-2" :messages="$message" />
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="password" :value="__('New Password')" />
|
||||
<x-text-input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
class="mt-1 block w-full"
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
@error("password")
|
||||
<x-input-error class="mt-2" :messages="$message" />
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
|
||||
<x-text-input
|
||||
id="password_confirmation"
|
||||
name="password_confirmation"
|
||||
type="password"
|
||||
class="mt-1 block w-full"
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
@error("password_confirmation")
|
||||
<x-input-error class="mt-2" :messages="$message" />
|
||||
@enderror
|
||||
</div>
|
||||
</form>
|
||||
<x-slot name="actions">
|
||||
<x-primary-button id="btn-save-password" form="update-password">
|
||||
{{ __("Save") }}
|
||||
</x-primary-button>
|
||||
</x-slot>
|
||||
</x-card>
|
@ -0,0 +1,80 @@
|
||||
@php
|
||||
$user = auth()->user();
|
||||
@endphp
|
||||
|
||||
<x-card>
|
||||
<x-slot name="title">
|
||||
{{ __("Profile Information") }}
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="description">
|
||||
{{ __("Update your account's profile information and email address.") }}
|
||||
</x-slot>
|
||||
|
||||
<form
|
||||
id="update-profile-information"
|
||||
hx-post="{{ route("profile.info") }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-select="#update-profile-information"
|
||||
hx-trigger="submit"
|
||||
hx-ext="disable-element"
|
||||
hx-disable-element="#btn-save-info"
|
||||
class="mt-6 space-y-6"
|
||||
>
|
||||
@csrf
|
||||
<div>
|
||||
<x-input-label for="name" :value="__('Name')" />
|
||||
<x-text-input
|
||||
id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
value="{{ old('name', auth()->user()->name) }}"
|
||||
class="mt-1 block w-full"
|
||||
required
|
||||
autocomplete="name"
|
||||
/>
|
||||
@error("name")
|
||||
<x-input-error class="mt-2" :messages="$message" />
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="email" :value="__('Email')" />
|
||||
<x-text-input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
value="{{ old('email', auth()->user()->email) }}"
|
||||
class="mt-1 block w-full"
|
||||
required
|
||||
autocomplete="email"
|
||||
/>
|
||||
@error("email")
|
||||
<x-input-error class="mt-2" :messages="$message" />
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="timezone" :value="__('Timezone')" />
|
||||
<x-select-input id="timezone" name="timezone" class="mt-1 block w-full" required>
|
||||
@foreach (timezone_identifiers_list() as $timezone)
|
||||
<option
|
||||
value="{{ $timezone }}"
|
||||
@if(old('timezone', auth()->user()->timezone) == $timezone) selected @endif
|
||||
>
|
||||
{{ $timezone }}
|
||||
</option>
|
||||
@endforeach
|
||||
</x-select-input>
|
||||
@error("timezone")
|
||||
<x-input-error class="mt-2" :messages="$message" />
|
||||
@enderror
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<x-slot name="actions">
|
||||
<x-primary-button id="btn-save-info" form="update-profile-information">
|
||||
{{ __("Save") }}
|
||||
</x-primary-button>
|
||||
</x-slot>
|
||||
</x-card>
|
Reference in New Issue
Block a user