Add fallback mechanism and logout button on 500 error page to prevent lock in change-password
This commit is contained in:
@@ -229,9 +229,17 @@ class UserController extends Controller
|
||||
/**
|
||||
* Show the change password form.
|
||||
*/
|
||||
public function changePasswordForm(): View
|
||||
public function changePasswordForm()
|
||||
{
|
||||
return view('user.change_password');
|
||||
try {
|
||||
return view('user.change_password');
|
||||
} catch (\Throwable $e) {
|
||||
\Illuminate\Support\Facades\Log::error('Error rendering change_password view: ' . $e->getMessage());
|
||||
return response()->view('errors.500', [
|
||||
'exception' => $e,
|
||||
'allowLogout' => true
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,10 +14,20 @@
|
||||
@endsection
|
||||
|
||||
@section('action')
|
||||
<button onclick="history.back();"
|
||||
class="btn-secondary w-full sm:w-auto text-[13px] h-[40px] px-6 flex items-center justify-center transition-all duration-300 hover:scale-[1.03] hover:bg-gray-100 active:scale-[0.97]">
|
||||
{{ __('errors.back') }}
|
||||
</button>
|
||||
@auth
|
||||
<form action="{{ route('logout') }}" method="POST" class="w-full sm:w-auto">
|
||||
@csrf
|
||||
<button type="submit"
|
||||
class="btn-secondary w-full sm:w-auto text-[13px] h-[40px] px-6 flex items-center justify-center transition-all duration-300 hover:scale-[1.03] hover:bg-gray-100 active:scale-[0.97] cursor-pointer">
|
||||
Đăng xuất
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<button onclick="history.back();"
|
||||
class="btn-secondary w-full sm:w-auto text-[13px] h-[40px] px-6 flex items-center justify-center transition-all duration-300 hover:scale-[1.03] hover:bg-gray-100 active:scale-[0.97]">
|
||||
{{ __('errors.back') }}
|
||||
</button>
|
||||
@endauth
|
||||
<a href="{{ url('/') }}"
|
||||
class="btn-primary w-full sm:w-auto text-[13px] h-[40px] px-6 flex items-center justify-center transition-all duration-300 hover:scale-[1.03] hover:bg-primary-hover active:scale-[0.97]">
|
||||
{{ __('errors.back_to_home') }}
|
||||
|
||||
Reference in New Issue
Block a user