feat(auth): guest Subscribe shows prompt + preserves intended URL
Clicking Subscribe as a guest used to redirect straight to /login with no
context. Now a short toast tells the visitor "Sign in to subscribe to
{channel}" and the redirect carries ?intended=<current path> so after
login they land back on the same video instead of the home page.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
1 parent
e550d8d15b
commit
f7c3b236ab
1 file changed
+7
-2
@@ -158,8 +158,13 @@
|
||||
</button>
|
||||
@endif
|
||||
@else
|
||||
<button onclick="window.location.href='{{ route('login') }}'" class="action-btn desktop-action">
|
||||
<i class="bi bi-bell"></i><span>Subscribe</span>
|
||||
{{-- Guest Subscribe: showToast first so the user understands what's
|
||||
happening, then redirect to the login page with intended=
|
||||
preserving the current URL so after login they land back on
|
||||
this video. 600 ms gives the toast a moment to be seen. --}}
|
||||
<button type="button" class="action-btn desktop-action"
|
||||
onclick="(function(){ if (typeof showToast==='function') showToast('Sign in to subscribe to {{ addslashes($video->user->name ?? 'this channel') }}', 'info'); setTimeout(function(){ window.location.href='{{ route('login') }}?intended=' + encodeURIComponent(window.location.pathname + window.location.search); }, 600); })();">
|
||||
<i class="bi bi-bell" aria-hidden="true"></i><span>Subscribe</span>
|
||||
</button>
|
||||
@endauth
|
||||
|
||||
|
||||
Reference in new issue
Block a user