diff --git a/packages/mukti-api/src/modules/auth/auth.controller.ts b/packages/mukti-api/src/modules/auth/auth.controller.ts index 669165d..6a164f2 100644 --- a/packages/mukti-api/src/modules/auth/auth.controller.ts +++ b/packages/mukti-api/src/modules/auth/auth.controller.ts @@ -4,11 +4,13 @@ import { Body, Controller, Delete, + ForbiddenException, Get, HttpCode, HttpStatus, Ip, Logger, + NotFoundException, Param, Patch, Post, @@ -55,6 +57,7 @@ import { } from './dto/auth.swagger'; import { LoginRateLimitGuard } from './guards/login-rate-limit.guard'; import { PasswordResetRateLimitGuard } from './guards/password-reset-rate-limit.guard'; +import { WaitlistService } from '../waitlist/waitlist.service'; import { AuthService } from './services/auth.service'; import { OAuthProfile, OAuthService } from './services/oauth.service'; import { SessionService } from './services/session.service'; @@ -79,6 +82,7 @@ export class AuthController { private readonly sessionService: SessionService, private readonly oauthService: OAuthService, private readonly configService: ConfigService, + private readonly waitlistService: WaitlistService, ) { this.cookieDomain = this.getCookieDomainFromConfig(); } @@ -430,6 +434,21 @@ export class AuthController { ): Promise { this.logger.log(`Registration attempt from IP ${ip}`); + const normalizedEmail = dto.email.trim().toLowerCase(); + dto.email = normalizedEmail; + + // Signups are restricted to emails already present in waitlist. + try { + await this.waitlistService.checkEmail(normalizedEmail); + } catch (error) { + if (error instanceof NotFoundException) { + throw new ForbiddenException( + 'Sign up is currently limited to waitlisted emails. Join the waitlist first.', + ); + } + throw error; + } + // Register user const result = await this.authService.register(dto); diff --git a/packages/mukti-api/src/modules/auth/auth.module.ts b/packages/mukti-api/src/modules/auth/auth.module.ts index c9c3839..03524cf 100644 --- a/packages/mukti-api/src/modules/auth/auth.module.ts +++ b/packages/mukti-api/src/modules/auth/auth.module.ts @@ -11,6 +11,7 @@ import { } from '../../schemas/refresh-token.schema'; import { Session, SessionSchema } from '../../schemas/session.schema'; import { User, UserSchema } from '../../schemas/user.schema'; +import { WaitlistModule } from '../waitlist/waitlist.module'; import { AuthController } from './auth.controller'; import { EmailVerifiedGuard } from './guards/email-verified.guard'; import { JwtAuthGuard } from './guards/jwt-auth.guard'; @@ -94,6 +95,7 @@ import { JwtStrategy } from './strategies/jwt.strategy'; ]), ConfigModule, + WaitlistModule, ], providers: [ AuthService, diff --git a/packages/mukti-web/src/app/(auth)/auth/page.tsx b/packages/mukti-web/src/app/(auth)/auth/page.tsx index f1fc750..1330382 100644 --- a/packages/mukti-web/src/app/(auth)/auth/page.tsx +++ b/packages/mukti-web/src/app/(auth)/auth/page.tsx @@ -1,5 +1,6 @@ 'use client'; +import { Leaf, ShieldCheck, Sparkles } from 'lucide-react'; import { useRouter, useSearchParams } from 'next/navigation'; import { Suspense, useEffect, useState } from 'react'; @@ -17,9 +18,9 @@ export default function AuthPage() {
-
+
{/* Logo/Title */} -
-

Mukti

+
+
+ Mukti + Socratic Workspace +

- Welcome back + {activeTab === 'signup' ? 'Begin with intention' : 'Welcome back'}

{activeTab === 'signup' - ? 'Create your account to begin your inquiry practice.' + ? 'Create your account with a waitlisted email to enter Mukti.' : 'Sign in to continue your inquiry journey.'}

+ {activeTab === 'signup' && ( +

+ Sign up is invite-gated through the waitlist. +

+ )}
{/* Tab Navigation */} @@ -160,6 +169,34 @@ function AuthContent() { )}
+ +
+
+
+ + Private +
+

Session-backed secure authentication.

+
+
+
+ + Calm +
+

+ Focused space designed for deep inquiry. +

+
+
+
+ + Guided +
+

+ Socratic prompts instead of instant answers. +

+
+
diff --git a/packages/mukti-web/src/components/auth/sign-up-form.tsx b/packages/mukti-web/src/components/auth/sign-up-form.tsx index 7c69ec3..12613cc 100644 --- a/packages/mukti-web/src/components/auth/sign-up-form.tsx +++ b/packages/mukti-web/src/components/auth/sign-up-form.tsx @@ -87,6 +87,12 @@ export function SignUpForm({ onSuccess, onSwitchToSignIn }: SignUpFormProps) { } }; + const registrationErrorMessage = + registerMutation.error instanceof Error + ? registerMutation.error.message + : 'Registration failed. Please try again.'; + const waitlistRestrictionError = registrationErrorMessage.toLowerCase().includes('waitlist'); + return (
@@ -236,10 +242,16 @@ export function SignUpForm({ onSuccess, onSwitchToSignIn }: SignUpFormProps) { {registerMutation.error && (

- {registerMutation.error instanceof Error - ? registerMutation.error.message - : 'Registration failed. Please try again.'} + {registrationErrorMessage}

+ {waitlistRestrictionError && ( + + Join the waitlist for access + + )}
)}