Express-Server für Appwrite-Auth, Session, Projekt-Dashboard und Gitea-Webhook; statisches Frontend und Schema-Dokumentation für woms-database. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
590 B
JavaScript
25 lines
590 B
JavaScript
import { createUserClient } from './appwriteAdmin.js'
|
|
|
|
export async function loginWithAppwrite(email, password) {
|
|
const { client, account } = createUserClient()
|
|
|
|
try {
|
|
await account.createEmailPasswordSession(email, password)
|
|
} catch (err) {
|
|
const message = err?.message || 'Anmeldung fehlgeschlagen'
|
|
const error = new Error(message)
|
|
error.status = 401
|
|
throw error
|
|
}
|
|
|
|
const user = await account.get()
|
|
|
|
try {
|
|
await account.deleteSession('current')
|
|
} catch {
|
|
// Portal nutzt eigene Session; Appwrite-Session wird nicht persistiert
|
|
}
|
|
|
|
return user
|
|
}
|