feat(auth): redirect users to source app after email verification

Add sourceAppUrl tracking during registration to redirect users back
to the app they registered from after email verification. Includes
URL validation for security (only *.mana.how, mana.how, localhost).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-01-27 01:31:31 +01:00
parent 3df7157389
commit 2ccd063628
21 changed files with 285 additions and 30 deletions

View file

@ -107,13 +107,22 @@ export function createAuthService(config: AuthServiceConfig) {
* @param email User email
* @param password User password
* @param referralCode Optional referral code for bonus credits
* @param sourceAppUrl Optional URL of the app where the user is registering
*/
async signUp(email: string, password: string, referralCode?: string): Promise<AuthResult> {
async signUp(
email: string,
password: string,
referralCode?: string,
sourceAppUrl?: string
): Promise<AuthResult> {
try {
const body: Record<string, string> = { email, password };
if (referralCode) {
body.referralCode = referralCode;
}
if (sourceAppUrl) {
body.sourceAppUrl = sourceAppUrl;
}
const response = await fetch(`${baseUrl}${endpoints.signUp}`, {
method: 'POST',