Have the live page determine if they're logged in and prevent the form until they do.

This commit is contained in:
Zed A. Shaw 2025-09-17 11:38:48 -04:00
parent fcb71add03
commit 609ca7b363

View file

@ -23,19 +23,31 @@
</table> </table>
</div> </div>
<form action="/api/link" method="POST"> <div class="flex flex-col"
<card class="card"> x-data="{auth: false}"
<top>Submit a Link</top> x-init="auth = await GetJson('/api/authcheck')">
<middle> <template x-if="auth.is_authed">
<input id="stream_id" name="stream_id" type="hidden" value="1"> <form action="/api/link" method="POST">
<input id="url" name="url" type="text" placeholder="Link Url"> <card class="card">
<input id="description" name="description" type="text" placeholder="Description"> <top>Submit a Link</top>
</middle> <middle>
<bottom> <input id="stream_id" name="stream_id" type="hidden" value="1">
<button id="submit" type="submit">Send It</button> <input id="url" name="url" type="text" placeholder="Link Url">
</bottom> <input id="description" name="description" type="text" placeholder="Description">
</card> </middle>
</form> <bottom>
<button id="submit" type="submit">Send It</button>
</bottom>
</card>
</form>
</template>
<template x-if="!auth.is_authed">
<aside>
<p><mark>Post Links</mark> You can post links after you <a href="/login/">Login</a>. If you want an account simply <a href="/register/">Register</a>.</p>
</aside>
</template>
</div>
</bar> </bar>
</div> </div>