Fokwa Best
Fokwa Best

Reputation: 3515

Unable to get complete URL in Password Reset in Laravel

I am using the Laravel 5 ResetsPasswords trait to implement password reset. In the file resources/views/emails/password.blade.php., I have the following code.

<a href="{{ url('/password/reset/'.$token) }}" class="btn btn-primary">Click To Reset Password</a>

I am using a queue to send the email to the user. When the user clicks the link received in email, I get something like below:

http://localhost/password/reset/2aafe5381baa67f9d1fe2f476c0f1395b21e71fafe181b2980fb838fc9e0b2fc

I was rather expecting:

http://localhost/oap/public/password/reset/2aafe5381baa67f9d1fe2f476c0f1395b21e71fafe181b2980fb838fc9e0b2fc

Why is oap/public/ not in the url? I have used the url() function in other views and they have worked just well except for this email view where I am using queue to send the message. When a queue is not used to send the message, the link is okay. Any idea how I can resolve this issue.

Upvotes: 0

Views: 1058

Answers (2)

Alsemany
Alsemany

Reputation: 445

for the url helpers it will generate the full path for your inputs

{{ url('/password/reset/'.$token) }}

will generate

http://localhost/password/reset/2aafe5381baa67f9d1fe2f476c0f1395b21e71fafe181b2980fb838fc9e0b2fc

and

{{ url('/oap/public/password/reset/'.$token) }}

will generate

http://localhost/oap/public/password/reset/2aafe5381baa67f9d1fe2f476c0f1395b21e71fafe181b2980fb838fc9e0b2fc

you can also get around this

Route::get('oap/public/password/reset/{confirmcode}', ['as' => 'resetpassword', 'HomeController@resetmethod']);

then using this like that

{{route('resetpassword', ['confirmcode' => $token])}}

Upvotes: 1

Vinod VT
Vinod VT

Reputation: 7164

Use URL::to. Like,

<a href="{{ URL::to('/password/reset/'.$token) }}" class="btn btn-primary">Click To Reset Password</a>

Upvotes: 1

Related Questions