0

It was easy enough to rem out the email field and add a username field. (After allit work with the loginview) It is using the username field for authentication just fine and I did the same thing.

\resources\views\auth\reset-password.blade.php ```

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

        <input type="hidden" name="token" value="{{ $request->route('token') }}">

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

        {{-- <div class="block">
            <x-jet-label for="email" value="{{ __('Email') }}" />
            <x-jet-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $request->email)" required autofocus />
        </div> --}}

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

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

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

but when I attempt to use it I get:

Whoops! Something went wrong.
The email field is required.

I can't figure out where the inputs are validated in order for me to make the changes needed for it to expect the username in place of the email address.

1 Answers1

0

Jetsteam uses fortify as it's backend. Change config\fortify.php

    /*
    |--------------------------------------------------------------------------
    | Username / Email
    |--------------------------------------------------------------------------
    |
    | This value defines which model attribute should be considered as your
    | application's "username" field. Typically, this might be the email
    | address of the users but you are free to change this value here.
    |
    | Out of the box, Fortify expects forgot password and reset password
    | requests to have a field named 'email'. If the application uses
    | another name for the field you may define it below as needed.
    |
    */

    'username' => 'username', // change this to username

    'email' => 'email',
Digvijay
  • 7,836
  • 3
  • 32
  • 53
  • I did that, and that's what allowed me to use the username to authenticate, but when using the link in the change password email, it asks for email address and the new password and it's confermation. – Robert Kirchhof Mar 28 '21 at 18:41
  • Change `resources/views/auth/reset-password.blade.php` code to use username – Digvijay Mar 29 '21 at 03:03
  • I did taht too, that is the file that I pasted in, in the first place. If you look closly the email address is commented out and I've added a username field. – Robert Kirchhof Mar 30 '21 at 11:20