mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 21:36:41 +02:00
✨ 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:
parent
3df7157389
commit
2ccd063628
21 changed files with 285 additions and 30 deletions
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue