Laravel 5.4 removing mail field when reseting password

Viewed 1044

I tried to know if there's a way to remove the email field when we reset password in Laravel (5.4). It's still a discussion in the github forum so I want to know if anyone here has find a clean solution to do it.

In fact, it doesn't make sense to have mail in password reset: enter image description here

1 Answers

Declare this function inside a helper file somewhere

function get_user_by_token($token){
    $records =  DB::table('password_resets')->get();
    foreach ($records as $record) {
        if (Hash::check($token, $record->token) ) {
           return $record->email;
        }
    }
}

Then Inside the reset.blade.php hide the from-group of the email and in the input email paste this !

value="{{ old('email') ?? get_user_by_token($token) }}"
Related