1
votes

I'd like to make this simple HTML link in blade template, Laravel 7.2.2:

<a href="http://user:[email protected]">Test</a>

Laravel keeps removing "user:pass@" part. What I get is:

<a href="http://site.test">Test</a>

I've tried using {!! !!} syntax, tried @php @endphp, tried some tricks with replacing string fragments with strtr but nothing worked.

How do I output raw URL with login and password?

1
How have you tried?Don't Panic
So long as you are using this only for testing, no real worries here, but please reconsider this approach if you are using it in production. It looks like a pretty big security issue to me. The answer provided below should solve your issue though, I believe.Kurt Friars

1 Answers

1
votes

The blade template engine is treating the @site as blade syntax and stripping it out.

Have you tried something like this:

<a href="{{ 'http://' . $user . ':' . $pass . '@' . 'site.test' }}">Test</a>

I don't claim this is the best solution! But by separating the @ symbol from the text you may bypass the problem