Customizing Standard Login Error Message - Jetstream

Asked

Viewed 86 times

-1

I’m starting my studies with Laravel. I’m using version 8 with Jetstream with Livewire for user authentication.

However, I couldn’t figure out how to change the Jetstream standard error message ("Whoops! Something Went Wrong.") during the "Whoops! Something Went Wrong."

The incorrect credentials message I managed to change through the file resources > lang > en > auth.

inserir a descrição da imagem aqui

This is my login view:

<x-guest-layout>
<x-jet-authentication-card>
    <x-slot name="logo">
        <x-jet-authentication-card-logo />
    </x-slot>

    <x-jet-validation-errors class="mb-4" />

    @if (session('status'))
        <div class="mb-4 font-medium text-sm text-green-600">
            {{ session('status') }}
        </div>
    @endif

    <form method="POST" action="{{ route('login') }}">
        @csrf

        <div>
            <x-jet-label for="email" value="{{ __('Usuário') }}" />
            <x-jet-input id="email" class="block mt-1 w-full" type="text" name="username" :value="old('email')" required autofocus />
        </div>

        <div class="mt-4">
            <x-jet-label for="password" value="{{ __('Senha') }}" />
            <x-jet-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="current-password" />
        </div>

        <div class="flex items-center justify-end mt-4">
            <x-jet-button class="ml-4">
                {{ __('Entrar') }}
            </x-jet-button>
        </div>
    </form>
</x-jet-authentication-card>

How can I change this default message from "Whoops! Something Went Wrong." to for example "Ops, an error has occurred"?

I have not overwritten any login method, it is Jetstream itself that is doing this.

Thank you in advance.

1 answer

1


Create the Resources/lang/en.json file and add

{
    "Whoops! Something went wrong.": "Ops! Algo deu errado"
}

I advise also take a look at the package "lucascudo/Laravel-en-localization"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.