Files
rhema-together/web/app/pages/login.vue
T
vhaudiquet 0035f4e031 feat: add the multiplayer room server and client
A room is one conversation, one ssh sandbox, and one agent. Accounts
create rooms; friends join through a single-use invite link and a
display name; the agent speaks only through the message tool.

The server is Axum and SQLite. It serves the built Nuxt client, streams
room events over SSE, and runs one serialized turn loop per room with
turn-level steering copied from rhema-code. The client has the chat,
preview iframe, read-only file pane, xterm terminal, and presence.

Preview URLs are signed wildcard hosts, and the proxy tunnels HTTP over
ssh direct-tcpip. HostAgent::step remains deferred in the framework.
2026-11-28 01:09:37 +01:00

85 lines
2.1 KiB
Vue

<script setup lang="ts">
import { ref } from 'vue'
import type { User } from '~/types'
import { apiErrorMessage } from '~/utils/errors'
definePageMeta({ layout: 'auth' })
useHead({ title: 'Sign in · rhema together' })
const api = useApi()
const { session, load } = useSession()
const identifier = ref('')
const password = ref('')
const submitting = ref(false)
const error = ref('')
async function submit() {
if (submitting.value) return
submitting.value = true
error.value = ''
try {
await api.post<User>('/login', {
identifier: identifier.value.trim(),
password: password.value,
})
await load(true)
await navigateTo('/rooms', { replace: true })
} catch (err) {
error.value = apiErrorMessage(err)
} finally {
submitting.value = false
}
}
</script>
<template>
<div>
<h1 class="auth-title">Sign in</h1>
<p class="auth-note">Use your handle or email.</p>
<form class="form" @submit.prevent="submit">
<div class="field">
<label class="field-label" for="login-identifier">Handle or email</label>
<input
id="login-identifier"
v-model="identifier"
class="input"
type="text"
autocomplete="username"
spellcheck="false"
autofocus
required
>
</div>
<div class="field">
<label class="field-label" for="login-password">Password</label>
<input
id="login-password"
v-model="password"
class="input"
type="password"
autocomplete="current-password"
required
>
</div>
<p v-if="error" class="form-error" role="alert">{{ error }}</p>
<button type="submit" class="btn btn-primary" :disabled="submitting">
{{ submitting ? 'Signing in' : 'Sign in' }}
</button>
</form>
<div class="auth-footer">
<template v-if="session.allowRegistration">
No account yet? <NuxtLink to="/register">Register</NuxtLink>
</template>
<template v-else>
Registration is closed. Ask a room owner for an invite link.
</template>
</div>
</div>
</template>