Signup page for Tophhie Social
at main 24 lines 779 B view raw
1import { AtpAgent } from '@atproto/api'; 2 3class SimpleSignUp { 4 constructor() { 5 this.agent = new AtpAgent({ service: 'https://tophhie.social' }); 6 } 7 8 async signUp(handle, email, password, turnstileToken, statusUpdateHandler) { 9 // `turnstileToken` is optional client-side token from Cloudflare Turnstile. 10 // Server-side verification is required; include the token when calling your backend. 11 const safeUpdate = (msg) => statusUpdateHandler && statusUpdateHandler(msg); 12 13 // Step 1: Create an account 14 safeUpdate('Creating account...'); 15 await this.agent.createAccount({ 16 email: email, 17 handle: handle + '.tophhie.social', 18 password: password, 19 }); 20 safeUpdate('Account created successfully!'); 21 } 22} 23 24export { SimpleSignUp };