0
votes

Within my project, I have given the administrator role the privilege to add users to the site. For security reasons, I hash a random string, to store as the temporary password, I then want to send the user an email with the standard Laravel reset password template.

I have the following:

$user = new User();
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->password = Hash::make(str_random(8));
$user->save();

$response = Password::sendResetLink(Input::get('email'), function (Message $message) {
        $message->subject('Password Reset');
    }); 

The error I'm getting is

Argument 1 passed to Illuminate\Auth\Passwords\PasswordBroker::sendResetLink() must be of the type array, string given

How can I trigger this function within Laravel, so the user is sent a password reset email? Thank you.

1
I think the error is pretty self-explanatory. The sendResetLink expects an array and you're providing a string. - pawelmysior
@PawelMysior, very true, that is the problem I am having. I'm unsure of what it wants within the Array. - user860511

1 Answers

1
votes

The problem here is that you are sending string email, and you should send array (this is what error says).

You should in this case use:

Request::only('email')

instead of

Input::get('email')